public override string ToString() { var la = Lat.ToString(CultureInfo.InvariantCulture); var lo = Lon.ToString(CultureInfo.InvariantCulture); return($"{la} {lo}"); }
public override string ToString() { return("{Lat=" + Lat.ToString(CultureInfo.CurrentCulture) + ",Lng=" + Lng.ToString(CultureInfo.CurrentCulture) + ",WidthLng=" + WidthLng.ToString(CultureInfo.CurrentCulture) + ",HeightLat=" + HeightLat.ToString(CultureInfo.CurrentCulture) + "}"); }
protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); PointF text = new PointF(CMB_coordsystem.Right + 3, 3); //Enum.GetValues(typeof(CoordsSystems), CMB_coordsystem.Text); if (System == CoordsSystems.GEO.ToString()) { e.Graphics.DrawString(Lat.ToString("0.000000") + " " + Lng.ToString("0.000000") + " " + Alt.ToString("0.00"), this.Font, new SolidBrush(this.ForeColor), text, StringFormat.GenericDefault); } else if (System == CoordsSystems.UTM.ToString()) { UTM utm = (UTM)point; //utm.East.ToString("0.00") + " " + utm.North.ToString("0.00") e.Graphics.DrawString(utm.ToString() + " " + Alt.ToString("0.00"), this.Font, new SolidBrush(this.ForeColor), text, StringFormat.GenericDefault); } else if (System == CoordsSystems.MGRS.ToString()) { MGRS mgrs = (MGRS)point; mgrs.Precision = 5; e.Graphics.DrawString(mgrs.ToString() + " " + Alt.ToString("0.00"), this.Font, new SolidBrush(this.ForeColor), text, StringFormat.GenericDefault); } }
/// <summary> /// 存储船舶状态信息 /// </summary> /// <param name="fileName"></param> public void StoreShipData(string fileName) { using (FileStream fs = new FileStream(@"D:\" + fileName + ".txt", FileMode.Append)) { //数据保存信息量为: //船号,纬度,经度,X坐标(m),Y坐标,航向角,航迹角,速度,速度等级,时间 //在速度等级后面增加舵角信息,舵角控制输出量信息和速度控制输出量信息 //共13个存储量 string str_data = ShipID.ToString() + "," + Lat.ToString("0.00000000") + "," + Lon.ToString("0.00000000") + "," + pos_X.ToString("0.000") + "," + pos_Y.ToString("0.000") + "," + phi.ToString("0.0") + "," + GPS_Phi.ToString("0.0") + "," + speed.ToString("0.00") + "," + gear.ToString() + "," + rud.ToString("0.0") + ',' + CtrlRudOut.ToString() + ',' + CtrlSpeedOut.ToString() + ',' + Time.ToString();//将数据转换为字符串 byte[] data = System.Text.Encoding.Default.GetBytes(str_data); byte[] data3 = new byte[2]; data3[0] = 0x0d; data3[1] = 0x0a; //开始写入 fs.Write(data, 0, data.Length); fs.Write(data3, 0, data3.Length); //清空缓冲区、关闭流 fs.Flush(); fs.Close(); } }
public override string ToString() { NumberFormatInfo nfi = new NumberFormatInfo(); nfi.NumberDecimalSeparator = "."; return($"{Lat.ToString(nfi)}, {Lng.ToString(nfi)}"); }
/// <summary> /// Получить часть URL /// </summary> /// <returns></returns> public override string GetPartUrl() { string str = ""; str += Lon.ToString().Replace(',', '.') + ","; str += Lat.ToString().Replace(',', '.') + ","; str += "pm"; if (_metAB) { str += _ab.GetDescription(); } else { str += _color.GetDescription(); str += _size.GetDescription(); if (_content > 0) { str += _content.ToString().Replace(',', '.'); } } return(str); }
private void HomeNavigationView_NavigationItemSelected(object sender, NavigationView.NavigationItemSelectedEventArgs e) { var menuItem = e.MenuItem; menuItem.SetChecked(!menuItem.IsChecked); Intent profil, bicycles, active, logout; string text = Intent.GetStringExtra("user") ?? "Data not available"; var user = JsonConvert.DeserializeObject <List <User> >(text); switch (menuItem.ItemId) { case Resource.Id.nav_bicycles: bicycles = new Intent(this, typeof(BicyclesActivity)); bicycles.PutExtra("user", text); bicycles.PutExtra("latitude", Lat.ToString()); bicycles.PutExtra("longitude", Lon.ToString()); StartActivity(bicycles); break; case Resource.Id.nav_active: active = new Intent(this, typeof(ActiveRentsActivity)); active.PutExtra("user", text); StartActivity(active); break; case Resource.Id.nav_profile: profil = new Intent(this, typeof(ProfileActivity)); profil.PutExtra("user", text); StartActivity(profil); break; case Resource.Id.nav_logout: logout = new Intent(this, typeof(LoginActivity)); StartActivity(logout); break; } }
public string AsMessage(int distance) { return (String.Format( "P;{0:ddMMyyHHmmss};{1};{2};{3}", Date, Lat.ToString("0000.0000").Replace(',', '.'), Lon.ToString("00000.0000").Replace(',', '.'), distance)); }
public void ToXml(XmlWriter writer) { writer.WriteStartElement("Plane"); writer.WriteElementString("Lon", Lon.ToString()); writer.WriteElementString("Lat", Lat.ToString()); writer.WriteElementString("Done", Done.ToString()); writer.WriteEndElement(); }
public string AsString(char separator = ',', bool reverse = false) { var cInfo = new CultureInfo("en-US", false); return(!reverse ? Lat.ToString(cInfo) + separator + Lng.ToString(cInfo) : Lng.ToString(cInfo) + separator + Lat.ToString(cInfo)); }
public virtual void SaveToXml(System.Xml.XmlTextWriter xmlWriter) { xmlWriter.WriteStartElement("ReferenceFrame"); xmlWriter.WriteAttributeString("Name", Name); xmlWriter.WriteAttributeString("Parent", Parent); xmlWriter.WriteAttributeString("ReferenceFrameType", ReferenceFrameType.ToString()); xmlWriter.WriteAttributeString("Reference", Reference.ToString()); xmlWriter.WriteAttributeString("ParentsRoationalBase", ParentsRoationalBase.ToString()); xmlWriter.WriteAttributeString("MeanRadius", MeanRadius.ToString()); xmlWriter.WriteAttributeString("Oblateness", Oblateness.ToString()); xmlWriter.WriteAttributeString("Heading", Heading.ToString()); xmlWriter.WriteAttributeString("Pitch", Pitch.ToString()); xmlWriter.WriteAttributeString("Roll", Roll.ToString()); xmlWriter.WriteAttributeString("Scale", Scale.ToString()); xmlWriter.WriteAttributeString("Tilt", Tilt.ToString()); xmlWriter.WriteAttributeString("Translation", Translation.ToString()); if (ReferenceFrameType == ReferenceFrameTypes.FixedSherical) { xmlWriter.WriteAttributeString("Lat", Lat.ToString()); xmlWriter.WriteAttributeString("Lng", Lng.ToString()); xmlWriter.WriteAttributeString("Altitude", Altitude.ToString()); } xmlWriter.WriteAttributeString("RotationalPeriod", RotationalPeriod.ToString()); xmlWriter.WriteAttributeString("ZeroRotationDate", ZeroRotationDate.ToString()); xmlWriter.WriteAttributeString("RepresentativeColor", SavedColor.Save(RepresentativeColor)); xmlWriter.WriteAttributeString("ShowAsPoint", ShowAsPoint.ToString()); xmlWriter.WriteAttributeString("ShowOrbitPath", ShowOrbitPath.ToString()); xmlWriter.WriteAttributeString("StationKeeping", StationKeeping.ToString()); if (ReferenceFrameType == ReferenceFrameTypes.Orbital) { xmlWriter.WriteAttributeString("SemiMajorAxis", SemiMajorAxis.ToString()); xmlWriter.WriteAttributeString("SemiMajorAxisScale", this.SemiMajorAxisUnits.ToString()); xmlWriter.WriteAttributeString("Eccentricity", Eccentricity.ToString()); xmlWriter.WriteAttributeString("Inclination", Inclination.ToString()); xmlWriter.WriteAttributeString("ArgumentOfPeriapsis", ArgumentOfPeriapsis.ToString()); xmlWriter.WriteAttributeString("LongitudeOfAscendingNode", LongitudeOfAscendingNode.ToString()); xmlWriter.WriteAttributeString("MeanAnomolyAtEpoch", MeanAnomolyAtEpoch.ToString()); xmlWriter.WriteAttributeString("MeanDailyMotion", MeanDailyMotion.ToString()); xmlWriter.WriteAttributeString("Epoch", Epoch.ToString()); } if (ReferenceFrameType == ReferenceFrameTypes.Trajectory) { xmlWriter.WriteStartElement("Trajectory"); foreach (TrajectorySample sample in Trajectory) { string data = sample.ToString(); xmlWriter.WriteElementString("Sample", data); } xmlWriter.WriteEndElement(); } xmlWriter.WriteEndElement(); }
public void WriteToConsole() { Console.WriteLine($"Postcode: {PostCode}"); Console.WriteLine($"Longitude: {Long.ToString()}"); Console.WriteLine($"Latitude: {Lat.ToString()}"); Console.WriteLine($"Region: {Region}"); Console.WriteLine($"District: {District}"); Console.WriteLine($"Ward: {Ward}"); }
public void ToXml(XmlWriter writer) { writer.WriteStartElement("Location"); writer.WriteElementString("Lon", Lon.ToString()); writer.WriteElementString("Lat", Lat.ToString()); writer.WriteElementString("Throttle", Throttle.ToString()); writer.WriteElementString("Rudder", Rudder.ToString()); writer.WriteEndElement(); }
/// <summary> /// Получить часть URL /// </summary> /// <returns></returns> public override string GetPartUrl() { string str = ""; str += Lon.ToString().Replace(',', '.') + ","; str += Lat.ToString().Replace(',', '.') + ","; str += "flag"; return(str); }
//ToXml function public void ToXml(XmlWriter xmlWriter) { xmlWriter.WriteElementString("oldLat", oldLat.ToString()); xmlWriter.WriteElementString("oldLon", oldLon.ToString()); xmlWriter.WriteElementString("Lat", Lat.ToString()); xmlWriter.WriteElementString("Lon", Lon.ToString()); xmlWriter.WriteElementString("Height", Height.ToString()); xmlWriter.WriteElementString("Throttel", Throttel.ToString()); xmlWriter.WriteElementString("Rudder", Rudder.ToString()); }
/// <summary> /// Получить часть URL /// </summary> /// <returns></returns> public override string GetPartUrl() { string str = ""; str += Lon.ToString().Replace(',', '.') + ","; str += Lat.ToString().Replace(',', '.') + ","; str += _mark.GetDescription(); return(str); }
public string Serialize() { if (IsZero) { return("null"); } else { return(string.Format("{0},{1}", Lat.ToString(CultureInfo.InvariantCulture), Lng.ToString(CultureInfo.InvariantCulture))); } }
/// <summary> /// this saves the info to the file. /// </summary> public void SaveToFile() { if (FileName != null) { string path = HttpContext.Current.Server.MapPath(String.Format(filePath, FileName)); string line = (Lat.ToString() + "," + Lon.ToString() + "," + Throttle.ToString() + "," + Rudder.ToString()); using (FileStream fs = new FileStream(path, FileMode.Append, FileAccess.Write)) using (StreamWriter sw = new StreamWriter(fs)) { sw.WriteLine(line); } } }
public const string SCENARIO_FILE = "~/App_Data/{0}.txt"; // The Path of the Secnario public void writeToFile() { string path = HttpContext.Current.Server.MapPath(String.Format(SCENARIO_FILE, FileName)); listen(); using (System.IO.StreamWriter file = new System.IO.StreamWriter(path, true)) { file.WriteLine(Lon.ToString()); file.WriteLine(Lat.ToString()); file.WriteLine(Throttle.ToString()); file.WriteLine(Rudder.ToString()); } }
public override string Serialize() { StringBuilder msg = new StringBuilder("'"); msg.Append(From); msg.Append(DELIMITER); msg.Append(Index); msg.Append(DELIMITER); msg.Append(Lat.ToString("#0.00000", CultureInfo.InvariantCulture)); msg.Append(DELIMITER); msg.Append(Lon.ToString("#0.00000", CultureInfo.InvariantCulture)); return(msg.ToString()); }
internal void SaveToXml(XmlTextWriter xmlWriter, string elementName) { xmlWriter.WriteStartElement(elementName); xmlWriter.WriteAttributeString("Name", name); xmlWriter.WriteAttributeString("DataSetType", Enums.ToXml("ImageSetType", (int)type)); if (this.Type == ImageSetType.Sky) { xmlWriter.WriteAttributeString("RA", camParams.RA.ToString()); xmlWriter.WriteAttributeString("Dec", camParams.Dec.ToString()); } else { xmlWriter.WriteAttributeString("Lat", Lat.ToString()); xmlWriter.WriteAttributeString("Lng", Lng.ToString()); } xmlWriter.WriteAttributeString("Constellation", constellation); xmlWriter.WriteAttributeString("Classification", Enums.ToXml("Classification", (int)classification)); xmlWriter.WriteAttributeString("Magnitude", magnitude.ToString()); xmlWriter.WriteAttributeString("Distance", distnace.ToString()); xmlWriter.WriteAttributeString("AngularSize", AngularSize.ToString()); xmlWriter.WriteAttributeString("ZoomLevel", ZoomLevel.ToString()); xmlWriter.WriteAttributeString("Rotation", camParams.Rotation.ToString()); xmlWriter.WriteAttributeString("Angle", camParams.Angle.ToString()); xmlWriter.WriteAttributeString("Opacity", camParams.Opacity.ToString()); xmlWriter.WriteAttributeString("Target", Enums.ToXml("SolarSystemObjects", (int)Target)); xmlWriter.WriteAttributeString("ViewTarget", camParams.ViewTarget.ToString()); xmlWriter.WriteAttributeString("TargetReferenceFrame", camParams.TargetReferenceFrame); //todo what do we do with full dome? // xmlWriter.WriteAttributeString("DomeAlt", camParams.DomeAlt.ToString()); // xmlWriter.WriteAttributeString("DomeAz", camParams.DomeAz.ToString()); xmlWriter.WriteStartElement("Description"); xmlWriter.WriteCData(HtmlDescription); xmlWriter.WriteEndElement(); if (backgroundImageSet != null) { xmlWriter.WriteStartElement("BackgroundImageSet"); Imageset.SaveToXml(xmlWriter, backgroundImageSet, ""); xmlWriter.WriteEndElement(); } if (studyImageset != null) { Imageset.SaveToXml(xmlWriter, studyImageset, ""); } xmlWriter.WriteEndElement(); }
public string APacket() { string str = "ADATA@"; str += StatId + '#'; str += StatNm + '#'; str += Adddoro + '#'; str += Lat.ToString() + '#'; str += Lng.ToString() + '#'; str += Usetime; return(str); }
public string XMLresult(string type) { string xmlstring = "<" + type + ">" + Environment.NewLine + "<Name>"; xmlstring += Name + "</Name>" + Environment.NewLine; xmlstring += "<Email>" + Email + "</Email>" + Environment.NewLine; xmlstring += "<Zone>" + Zone + "</Zone>" + Environment.NewLine; xmlstring += "<Id>" + Id.ToString() + "</Id>" + Environment.NewLine; xmlstring += "<Lat>" + Lat.ToString() + "</Lat>" + Environment.NewLine; xmlstring += "<Long>" + Long.ToString() + "</Long>" + Environment.NewLine; xmlstring += "<Mode>" + Mode.ToString() + "</Mode>" + Environment.NewLine; xmlstring += "<Status>" + Status.ToString() + "</Status>" + Environment.NewLine; xmlstring += "</" + type + ">" + Environment.NewLine; return(xmlstring); }
public override string Serialize() { // Convert PBH values into MSFS format. double p = (double)Pitch / -360.0; if (p < 0) { p += 1.0; } p *= 1024.0; double b = (double)Bank / -360.0; if (b < 0) { b += 1.0; } b *= 1024.0; double h = (double)Heading / 360.0 * 1024.0; // Shift the values into a 32 bit integer. uint pbh = ((uint)p << 22) | ((uint)b << 12) | ((uint)h << 2); // Assemble the PDU. StringBuilder msg = new StringBuilder("@"); msg.Append(IsIdenting ? "Y" : (mIsSquawkingModeC ? "N" : "S")); msg.Append(DELIMITER); msg.Append(From); msg.Append(DELIMITER); msg.Append(SquawkCode.ToString("0000")); msg.Append(DELIMITER); msg.Append((int)Rating); msg.Append(DELIMITER); msg.Append(Lat.ToString("#0.0000000", CultureInfo.InvariantCulture)); msg.Append(DELIMITER); msg.Append(Lon.ToString("#0.0000000", CultureInfo.InvariantCulture)); msg.Append(DELIMITER); msg.Append(TrueAltitude); msg.Append(DELIMITER); msg.Append(GroundSpeed); msg.Append(DELIMITER); msg.Append(pbh); msg.Append(DELIMITER); msg.Append(PressureAltitude - TrueAltitude); return(msg.ToString()); }
/// <summary> /// 转换WebApi概略位置实体为dal层概略位置基础信息 /// </summary> /// <returns>dal层概略位置</returns> public GGAHistory ToGGAHistory() { GGAHistory ggaHistory = new GGAHistory() { ID = ID, Account = Account, AccountType = AccountType, AccountSYS = AccountSYS, FixedTime = FixedTime, Lng = decimal.Parse(Lng.ToString()), Lat = decimal.Parse(Lat.ToString()), Status = Status, GGAInfo = GGAInfo }; return(ggaHistory); }
public string APakcet() { string str = "ADATA@"; str += StatId + '#'; str += StatNm + '#'; str += AddrDoro + '#'; str += Lat.ToString() + '#'; str += Lng.ToString() + '#'; str += UseTime + '#'; str += ChgerId.ToString() + '#'; str += ChgerType.ToString() + '#'; str += Stat.ToString() + '#'; str += StatTime; return(str); }
public override string ToString() { var sb = new StringBuilder(); sb.Append(Date.ToString("yyyyMMdd HH:00") + ","); sb.Append(Lat.ToString() + ","); sb.Append(Lon.ToString() + ","); sb.Append(SNOWDAS_SnowDepth_mm.ToString() + ","); sb.Append(SNOWDAS_SWE_mm.ToString() + ","); sb.Append(SNOWDAS_SnowmeltRunoff_micromm.ToString() + ","); sb.Append(SNOWDAS_Sublimation_micromm.ToString() + ","); sb.Append(SNOWDAS_SublimationBlowing_micromm.ToString() + ","); sb.Append(SNOWDAS_SolidPrecip_kgpersquarem.ToString() + ","); sb.Append(SNOWDAS_LiquidPrecip_kgpersquarem.ToString() + ","); sb.Append(SNOWDAS_SnowpackAveTemp_k.ToString()); return(sb.ToString()); }
/// <summary> /// 存储船舶状态信息 /// </summary> /// <param name="fileName"></param> public void StoreShipData(string fileName, DataTable dataRec) { /*using (FileStream fs = new FileStream(@"D:\" + fileName + ".txt", FileMode.Append)) * { * //数据保存信息量为: * //船号,纬度,经度,X坐标(m),Y坐标,和领队误差,航向角,航迹角,速度,速度等级,时间 * //在速度等级后面增加舵角信息,舵角控制输出量信息和速度控制输出量信息 * //共13个存储量 * string str_data = ShipID.ToString() + "," + Lat.ToString("0.00000000") + "," + Lon.ToString("0.00000000") + "," + pos_X.ToString("0.000") + "," + pos_Y.ToString("0.000") + "," + XError.ToString("0.000") + "," + phi.ToString("0.0") + "," + GPS_Phi.ToString("0.0") + "," + speed.ToString("0.00") + "," + gear.ToString() + "," + rud.ToString("0.0") + ',' + CtrlRudOut.ToString() + ',' + CtrlSpeedOut.ToString() + ',' + Time.ToString();//将数据转换为字符串 + + byte[] data = System.Text.Encoding.Default.GetBytes(str_data); + byte[] data3 = new byte[2]; + data3[0] = 0x0d; data3[1] = 0x0a; + //开始写入 + fs.Write(data, 0, data.Length); + + fs.Write(data3, 0, data3.Length); + + //清空缓冲区、关闭流 + fs.Flush(); + fs.Close(); + }*/ /*gridView.Rows.Add(ShipID.ToString(), Lat.ToString("0.00000000"), Lon.ToString("0.00000000"), * pos_X.ToString("0.000"), pos_Y.ToString("0.000"), XError.ToString("0.000"), * phi.ToString("0.0"), GPS_Phi.ToString("0.0"), * speed.ToString("0.00"), gear.ToString(), * rud.ToString("0.0"), CtrlRudOut.ToString(), CtrlSpeedOut.ToString(), * Time.ToString());*/ dataRec.Rows.Add(new object[] { ShipID.ToString(), Lat.ToString("0.00000000"), Lon.ToString("0.00000000"), Fter_pos_X.ToString("0.000"), Fter_pos_Y.ToString("0.000"), XError.ToString("0.000"), phi.ToString("0.0"), GPS_Phi.ToString("0.0"), Fter_GPS_Phi.ToString("0.0"), speed.ToString("0.00"), gear.ToString(), rud.ToString("0.0"), CtrlRudOut.ToString(), CtrlSpeedOut.ToString(), e1.ToString(), e2.ToString(), Vf.ToString(), F2.ToString(), MotorSpd.ToString(), HUST_1_Demo.Form1.followLineID.ToString(),//多段直线ID戳 sTime.ToString() }); }
public void StoreShipData(string fileName) { using (FileStream fs = new FileStream(@"D:\" + fileName + ".txt", FileMode.Append)) { string str_data = ShipID.ToString() + "," + Lat.ToString("0.00000000") + "," + Lon.ToString("0.00000000") + "," + pos_X.ToString() + "," + pos_Y.ToString() + "," + phi.ToString() + "," + GPS_Phi.ToString() + "," + speed.ToString("0.000") + "," + gear.ToString() + "," + Time.ToString();//将数据转换为字符串 byte[] data = System.Text.Encoding.Default.GetBytes(str_data); byte[] data3 = new byte[2]; data3[0] = 0x0d; data3[1] = 0x0a; //开始写入 fs.Write(data, 0, data.Length); fs.Write(data3, 0, data3.Length); //清空缓冲区、关闭流 fs.Flush(); fs.Close(); } }
public override string Serialize() { StringBuilder msg = new StringBuilder("%"); msg.Append(From); msg.Append(DELIMITER); msg.Append(Frequency); msg.Append(DELIMITER); msg.Append((int)Facility); msg.Append(DELIMITER); msg.Append(VisibilityRange); msg.Append(DELIMITER); msg.Append((int)Rating); msg.Append(DELIMITER); msg.Append(Lat.ToString("#0.00000", CultureInfo.InvariantCulture)); msg.Append(DELIMITER); msg.Append(Lon.ToString("#0.00000", CultureInfo.InvariantCulture)); msg.Append(DELIMITER); msg.Append("0"); return(msg.ToString()); }