Пример #1
0
 public override void ToStream(Stream output)
 {
     output.Write(TLUtils.SignatureToBytes(Signature));
     output.Write(Long.ToBytes());
     output.Write(Lat.ToBytes());
     output.Write(AccessHash.ToBytes());
 }
Пример #2
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);
        }
Пример #3
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();
            }
        }
Пример #4
0
        /// <summary>
        /// Returns true if Thing instances are equal
        /// </summary>
        /// <param name="other">Instance of Thing to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(FriendFinder other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     NickName == other.NickName ||
                     NickName != null &&
                     NickName.Equals(other.NickName)
                     ) &&
                 (
                     Lat == other.Lat ||
                     Lat != null &&
                     Lat.Equals(other.Lat)
                 ) &&
                 (
                     LastSeen == other.LastSeen ||
                     LastSeen != null &&
                     LastSeen.Equals(other.LastSeen)
                 ) &&
                 (
                     Lon == other.Lon ||
                     Lon != null &&
                     Lon.Equals(other.Lon)
                 ));
        }
Пример #5
0
        /// <summary>
        /// Returns true if Address instances are equal
        /// </summary>
        /// <param name="other">Instance of Address to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Location other)
        {
            // credit: http://stackoverflow.com/a/10454552/677735
            if (other == null)
            {
                return(false);
            }

            return
                ((
                     LocationId == other.LocationId ||
                     LocationId != null &&
                     LocationId.Equals(other.LocationId)
                     ) &&
                 (
                     Lon == other.Lon ||
                     Lon != null &&
                     Lon.Equals(other.Lon)
                 ) &&
                 (
                     Lat == other.Lat ||
                     Lat != null &&
                     Lat.Equals(other.Lat)
                 ));
        }
Пример #6
0
 public override int GetHashCode()
 {
     unchecked
     {
         return((Lat.GetHashCode() * 397) ^ Lng.GetHashCode());
     }
 }
Пример #7
0
        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;
            }
        }
Пример #8
0
        public override string ToString()
        {
            NumberFormatInfo nfi = new NumberFormatInfo();

            nfi.NumberDecimalSeparator = ".";
            return($"{Lat.ToString(nfi)}, {Lng.ToString(nfi)}");
        }
Пример #9
0
        }                               //          "2008"}],

        public void Add(double posTime_ms, double lat_deg, double long_deg)
        {
            PosTime.Add(posTime_ms);
            Lat.Add(lat_deg);
            Long.Add(long_deg);
            Count++;
        }
Пример #10
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Id != null)
         {
             hashCode = hashCode * 59 + Id.GetHashCode();
         }
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (Lat != null)
         {
             hashCode = hashCode * 59 + Lat.GetHashCode();
         }
         if (Lon != null)
         {
             hashCode = hashCode * 59 + Lon.GetHashCode();
         }
         if (Country != null)
         {
             hashCode = hashCode * 59 + Country.GetHashCode();
         }
         return(hashCode);
     }
 }
Пример #11
0
        public override string ToString()
        {
            var la = Lat.ToString(CultureInfo.InvariantCulture);
            var lo = Lon.ToString(CultureInfo.InvariantCulture);

            return($"{la} {lo}");
        }
Пример #12
0
        /// <inheritdoc />
        public bool Equals([AllowNull] Rotation other)
        {
            if (other == null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Lon == other.Lon ||
                     Lon != null &&
                     Lon.Equals(other.Lon)
                     ) &&
                 (
                     Lat == other.Lat ||
                     Lat != null &&
                     Lat.Equals(other.Lat)
                 ) &&
                 (
                     Roll == other.Roll ||
                     Roll != null &&
                     Roll.Equals(other.Roll)
                 ));
        }
Пример #13
0
        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);
            }
        }
Пример #14
0
 public override byte[] ToBytes()
 {
     return(TLUtils.Combine(
                TLUtils.SignatureToBytes(Signature),
                Lat.ToBytes(),
                Long.ToBytes()));
 }
 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) + "}");
 }
Пример #16
0
        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));
        }
Пример #17
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));
 }
Пример #18
0
 public override int GetHashCode()
 {
     if (IsEmpty)
     {
         return(0);
     }
     return(((Lng.GetHashCode() ^ Lat.GetHashCode()) ^ WidthLng.GetHashCode()) ^ HeightLat.GetHashCode());
 }
Пример #19
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();
 }
        /// <summary>
        /// Returns true if ThingsWithObservation instances are equal
        /// </summary>
        /// <param name="other">Instance of ThingsWithObservation to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ThingsWithObservation other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                     ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     Description == other.Description ||
                     Description != null &&
                     Description.Equals(other.Description)
                 ) &&
                 (
                     ThingTemplate == other.ThingTemplate ||
                     ThingTemplate != null &&
                     ThingTemplate.Equals(other.ThingTemplate)
                 ) &&
                 (
                     Status == other.Status ||
                     Status != null &&
                     Status.Equals(other.Status)
                 ) &&
                 (
                     Lat == other.Lat ||
                     Lat != null &&
                     Lat.Equals(other.Lat)
                 ) &&
                 (
                     Lon == other.Lon ||
                     Lon != null &&
                     Lon.Equals(other.Lon)
                 ) &&
                 (
                     Ogcid == other.Ogcid ||
                     Ogcid != null &&
                     Ogcid.Equals(other.Ogcid)
                 ) &&
                 (
                     Observations == other.Observations ||
                     Observations != null &&
                     Observations.SequenceEqual(other.Observations)
                 ));
        }
Пример #21
0
    public override int GetHashCode()
    {
        var hashCode = 1248711632;

        hashCode = hashCode * -1521134295 + Lat.GetHashCode();
        hashCode = hashCode * -1521134295 + Lon.GetHashCode();
        hashCode = hashCode * -1521134295 + Alt.GetHashCode();
        return(hashCode);
    }
        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}");
 }
Пример #24
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();
 }
Пример #25
0
        /// <summary>
        /// Получить часть URL
        /// </summary>
        /// <returns></returns>
        public override string GetPartUrl()
        {
            string str = "";

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

            str += "flag";
            return(str);
        }
Пример #26
0
 //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());
 }
Пример #27
0
        public override bool Equals(object obj)
        {
            var point = obj as MapPoint;

            if (point == null)
            {
                return(false);
            }

            return(Lat.CompareTo(point.Lat) == 0 && Lon.CompareTo(point.Lon) == 0);
        }
Пример #28
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);
        }
        public int CompareTo(LatLong other)
        {
            var res = Lat.CompareTo(other.Lat);

            if (res != 0)
            {
                return(res);
            }

            return(Lon.CompareTo(other.Lon));
        }
Пример #30
0
 public Address(Identity id, City city, Country country, District district, Lat lat, Lng lng, Street street, StreetNumber streetNumber)
 {
     Id           = id;
     City         = city;
     Country      = country;
     District     = district;
     Lat          = lat;
     Lng          = lng;
     Street       = street;
     StreetNumber = streetNumber;
 }