Exemple #1
0
        /// <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);
        }
Exemple #2
0
 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));
 }
Exemple #3
0
 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();
 }
Exemple #4
0
        public override string ToString()
        {
            string specifier = "00.0000";

            return(string.Format("{0}, {1}",
                                 Lat.ToString(specifier, CultureInfo.InvariantCulture),
                                 Lon.ToString(specifier, CultureInfo.InvariantCulture)));
        }
Exemple #5
0
 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();
 }
Exemple #6
0
        /// <summary>
        /// Получить часть URL
        /// </summary>
        /// <returns></returns>
        public override string GetPartUrl()
        {
            string str = "";

            str += Lon.ToString().Replace(',', '.') + ",";
            str += Lat.ToString().Replace(',', '.') + ",";

            str += "flag";
            return(str);
        }
Exemple #7
0
        /// <summary>
        /// Получить часть URL
        /// </summary>
        /// <returns></returns>
        public override string GetPartUrl()
        {
            string str = "";

            str += Lon.ToString().Replace(',', '.') + ",";
            str += Lat.ToString().Replace(',', '.') + ",";

            str += _mark.GetDescription();

            return(str);
        }
Exemple #8
0
 /// <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);
             }
     }
 }
Exemple #9
0
        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 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());
        }
        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());
        }
        public void addYourselfToXml(XDocument xDocument)
        {
            XElement root = xDocument.Element("Locations");
            IEnumerable <XElement> rows = root.Descendants("Location");
            XElement firstRow           = rows.Last();

            firstRow.AddAfterSelf(
                new XElement("Location",
                             new XElement("Lat", Lat.ToString()),
                             new XElement("Lon", Lon.ToString()),
                             new XElement("Rudder", Rudder.ToString()),
                             new XElement("Throttle", Throttle.ToString())));

            /* XElement root = xDocument.Element("Locations");
             * XElement son = new XElement("Location");
             * son.Add(new XElement("Lat", Lat.ToString()));
             * son.Add(new XElement("Lon", Lon.ToString()));
             * son.Add(new XElement("Rudder", Rudder.ToString()));
             * son.Add(new XElement("Throttle", Lat.ToString()));
             * root.Add(son);*/
        }
Exemple #13
0
 public string[] TransformRecord2String()
 {
     string[] arrayRec = { Cod, Sensor, Fecha, Temperatura.ToString(), Estacion, Dep, Mun, Zona, Lat.ToString(), Lon.ToString(), Descrip, Centi };
     return(arrayRec);
 }
Exemple #14
0
 /// <summary>
 /// 字符串
 /// </summary>
 /// <returns></returns>
 public override string ToString()
 {
     return(Lon.ToString() + "," + Lat.ToString() + "," + Height.ToString());
 }
Exemple #15
0
 /// <summary>
 /// 字符输出
 /// </summary>
 /// <param name="format"></param>
 /// <param name="spliter"></param>
 /// <returns></returns>
 public override string ToString(string format, string spliter = ", ")
 {
     return(Lon.ToString(format) + spliter + Lat.ToString(format) + spliter + Height.ToString(format));
 }
Exemple #16
0
 /// <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() });
 }
Exemple #17
0
        public override string Format()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("ATLAS2,");
            sb.Append(DataTime.ToString());
            sb.Append(",");
            sb.Append(TrackId);
            sb.Append(",");
            sb.Append(Status);
            sb.Append(",");
            //sb.Append(Name);
            sb.Append(EncodeStr.Encode(Name));
            sb.Append(",");
            sb.Append(ShortName);
            sb.Append(",");
            //5
            sb.Append(CallSign);
            sb.Append(",");
            sb.Append(ShipType);
            sb.Append(",");
            sb.Append(Length);
            sb.Append(",");
            sb.Append(Width);
            sb.Append(",");
            sb.Append(Lon.ToString("F6"));
            sb.Append(",");
            //10
            sb.Append(Lat.ToString("F6"));
            sb.Append(",");
            sb.Append(COG.ToString("F1"));
            sb.Append(",");
            sb.Append(SOG.ToString("F1"));
            sb.Append(",");
            sb.Append(Heading);
            sb.Append(",");
            sb.Append(TimeLastUpdate.ToString());
            sb.Append(",");
            //15
            sb.Append(ObjType);
            sb.Append(",");
            sb.Append(TargetType);
            sb.Append(",");
            sb.Append(PilotStatus);
            sb.Append(",");
            sb.Append(Rating);
            sb.Append(",");
            sb.Append(LabelColorIndex);
            sb.Append(",");
            //20
            sb.Append(Category);
            sb.Append(",");
            sb.Append(MMSI);
            sb.Append(",");
            sb.Append(TransponderState);
            sb.Append(",");
            sb.Append(DBTrackId);
            sb.Append(",");
            sb.Append(Draught);
            sb.Append(",");
            //25
            //sb.Append(InfoTxt);
            sb.Append(EncodeStr.Encode(InfoTxt));
            sb.Append(",");
            sb.Append(ETA);
            sb.Append(",");
            sb.Append(ETAEndPoint);
            sb.Append(",");
            sb.Append(RateOfTurn);
            sb.Append(",");
            sb.Append(AISNavStatus);
            sb.Append(",");
            //30
            sb.Append(AISRateOfTurn);
            sb.Append(",");
            sb.Append(AISSOG);
            sb.Append(",");
            sb.Append(AISLatitude);
            sb.Append(",");
            sb.Append(AISLongitude);
            sb.Append(",");
            sb.Append(AISCOG);
            sb.Append(",");
            //35
            sb.Append(AISTrueHeading);
            sb.Append(",");
            sb.Append(AISETA);
            sb.Append(",");
            sb.Append(AISDraught);
            sb.Append(",");
            sb.Append(AISTimeOfLastUpdate);
            sb.Append(",");
            sb.Append(Time.ToString());
            sb.Append(",");
            //40
            sb.Append(GID);
            sb.Append(",");
            sb.Append(FID);
            sb.Append(",");
            string result = sb.ToString();

            return(result);
        }
Exemple #18
0
 /// <summary>
 /// 字符输出
 /// </summary>
 /// <param name="format"></param>
 /// <param name="spliter"></param>
 /// <returns></returns>
 public virtual string ToString(string format, string spliter = ", ")
 {
     return(Lon.ToString(format) + spliter + Lat.ToString(format));
 }
Exemple #19
0
 /// <summary>
 /// 紧凑的数字,用逗号分隔。
 /// </summary>
 /// <returns></returns>
 public string ToCompactString()
 {
     return(Lon.ToString("0.0000000") + "," + Lat.ToString("0.0000000"));
 }
Exemple #20
0
 public virtual string GetDescription()
 {
     return(string.Format("MMSI({0}),船名({1}),经度({2}),纬度({3}),航速({4}节),航向({5}°)", MMSI, Name, Lon.ToString("F6"), Lat.ToString("F6"), SOG.ToString("F2"), COG.ToString("F1")));
 }
Exemple #21
0
 /// <summary>
 /// ×Ö·û´®
 /// </summary>
 /// <param name="spliter"></param>
 /// <returns></returns>
 public string ToString(string spliter)
 {
     return(Lon.ToString("0.000000") + spliter + Lat.ToString("0.000000") + spliter + Radius.ToString("0.000000"));
 }
Exemple #22
0
        /// <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();
            }
        }
Exemple #23
0
 override public string ToString()
 {
     return(Lat.ToString() + " , " + Lon.ToString());
 }
Exemple #24
0
        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();
            }
        }