public HttpResponseMessage Get(string jobId) { List <GpsLocation> location = new List <GpsLocation>(); location.Add(new GpsLocation() { lat = 3.133160f, lng = 101.722306f }); location.Add(new GpsLocation() { lat = 3.114616f, lng = 101.677515f }); location.Add(new GpsLocation() { lat = 3.074861f, lng = 101.614154f }); location.Add(new GpsLocation() { lat = 3.028194f, lng = 101.534769f }); GpsLocation from = new GpsLocation() { lat = 3.114159f, lng = 101.737470f }; // var result = Utility.Utils.GetSimpleRoute(from, from, location.ToArray(), new DateTime()); var result = Utility.Utils.GetDistance(from, location.ToArray(), 0, Utility.Utils.GetEpochTime(new DateTime(2006, 12, 5, 12, 00, 00))); return(new HttpResponseMessage() { Content = new StringContent(Utility.Utils.EncodeUniqueId(jobId)) }); }
/// <summary> /// Generates a random GPS location in a target area. /// </summary> /// <param name="BasePoint">Centre of the target area.</param> /// <param name="Radius">Radius of the target area.</param> /// <returns>GPS location within the target area.</returns> public static GpsLocation GenerateLocation(GpsLocation BasePoint, uint Radius) { double bearing = Rng.NextDouble() * 360.0; double distance = Rng.NextDouble() * (double)Radius; return(BasePoint.GoVector(bearing, distance)); }
private void followDeviceByGPSToolStripMenuItem_Click(object sender, EventArgs e) { if (StationList.SelectedIndices.Count > 0) { Station station = this.FilterStations[StationList.SelectedIndices[0]]; if (station != null) { if (station.HasGpsLocation(MainForm.GpsLocations.ToArray())) { using (SaveFileDialog dialog = new SaveFileDialog()) { if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { File.WriteAllText(dialog.FileName, GpsLocation.ToKML(station.GetGpsLocations(MainForm.GpsLocations.ToArray()))); } } } else { MessageBox.Show("No GPS Data is known for this station"); } } } }
/// <summary> /// Copies values from signed activity information to properties of this instance of the activity. /// </summary> /// <param name="SignedActivity">Signed description of the activity.</param> /// <param name="PrimaryServerId">In case of NeighborActivity, this is identifier of the primary proximity server of the activity.</param> public void CopyFromSignedActivityInformation(SignedActivityInformation SignedActivity, byte[] PrimaryServerId = null) { ActivityInformation activity = SignedActivity.Activity; GpsLocation activityLocation = new GpsLocation(activity.Latitude, activity.Longitude); byte[] pubKey = activity.OwnerPublicKey.ToByteArray(); byte[] identityId = Crypto.Sha256(pubKey); this.Version = new SemVer(activity.Version).ToByteArray(); this.ActivityId = activity.Id; this.OwnerIdentityId = identityId; this.OwnerPublicKey = pubKey; this.OwnerProfileServerId = activity.ProfileServerContact.NetworkId.ToByteArray(); this.OwnerProfileServerIpAddress = activity.ProfileServerContact.IpAddress.ToByteArray(); this.OwnerProfileServerPrimaryPort = (ushort)activity.ProfileServerContact.PrimaryPort; this.Type = activity.Type; this.LocationLatitude = activityLocation.Latitude; this.LocationLongitude = activityLocation.Longitude; this.PrecisionRadius = activity.Precision; this.StartTime = ProtocolHelper.UnixTimestampMsToDateTime(activity.StartTime).Value; this.ExpirationTime = ProtocolHelper.UnixTimestampMsToDateTime(activity.ExpirationTime).Value; this.Signature = SignedActivity.Signature.ToByteArray(); this.ExtraData = activity.ExtraData; if (this is NeighborActivity) { (this as NeighborActivity).PrimaryServerId = PrimaryServerId; } }
/// <summary> /// Creates a new instance of activity information from the activity. /// </summary> /// <returns>New instance of the ActivityInformation structure.</returns> public ActivityInformation ToActivityInformation() { GpsLocation activityLocation = this.GetLocation(); ActivityInformation res = new ActivityInformation() { Version = new SemVer(this.Version).ToByteString(), Id = this.ActivityId, OwnerPublicKey = ProtocolHelper.ByteArrayToByteString(this.OwnerPublicKey), ProfileServerContact = new ServerContactInfo() { IpAddress = ProtocolHelper.ByteArrayToByteString(this.OwnerProfileServerIpAddress), NetworkId = ProtocolHelper.ByteArrayToByteString(this.OwnerProfileServerId), PrimaryPort = this.OwnerProfileServerPrimaryPort, }, Type = this.Type != null ? this.Type : "", Latitude = activityLocation.GetLocationTypeLatitude(), Longitude = activityLocation.GetLocationTypeLongitude(), Precision = this.PrecisionRadius, StartTime = ProtocolHelper.DateTimeToUnixTimestampMs(this.StartTime), ExpirationTime = ProtocolHelper.DateTimeToUnixTimestampMs(this.ExpirationTime), ExtraData = this.ExtraData != null ? this.ExtraData : "" }; return(res); }
public void An_Empty_GpsLocation_Is_At_The_Equator_On_The_Prime_Meridian() { var sut = new GpsLocation(); sut.Latitude.Should().Be(0); sut.Longitude.Should().Be(0); }
/// <summary> /// Creates a new instance of a profile server. /// </summary> /// <param name="Name">Unique profile server instance name.</param> /// <param name="Location">GPS location of this profile server instance.</param> /// <param name="Port">Base TCP port that defines the range of ports that are going to be used by this profile server instance and its related servers.</param> public ProfileServer(string Name, GpsLocation Location, int Port) { log = new PrefixLogger("ProfileServerSimulator.ProfileServer", "[" + Name + "] "); log.Trace("(Name:'{0}',Location:{1},Port:{2})", Name, Location, Port); this.name = Name; this.location = Location; basePort = Port; ipAddress = IPAddress.Parse("127.0.0.1"); locPort = basePort; primaryInterfacePort = basePort + 1; serverNeighborInterfacePort = basePort + 2; clientNonCustomerInterfacePort = basePort + 3; clientCustomerInterfacePort = basePort + 4; clientAppServiceInterfacePort = basePort + 5; availableIdentitySlots = MaxHostedIdentities; hostedIdentities = new List <IdentityClient>(); nodeLocation = new Iop.Locnet.GpsLocation() { Latitude = Location.GetLocationTypeLatitude(), Longitude = Location.GetLocationTypeLongitude() }; initializationNeighborhoodNotificationList = new HashSet <ProfileServer>(); log.Trace("(-)"); }
public static MultiGpsLocation FromCollection <T>( IReadOnlyCollection <T> items, Func <T, GpsLocation> selector) { if (items.Count == 0) { return(null); } bool first = true; GpsLocation value = null; foreach (GpsLocation item in items.Select(selector)) { if (first) { value = item; first = false; } else if ( (item == null && value != null) || (item != null && !item.Equals(value))) { return(new MultiGpsLocation(value, Consistency.Inconsistent)); } } return(new MultiGpsLocation(value, Consistency.Consistent)); }
protected async override void OnActivate() { base.OnActivate(); ResetToUnavailableData(); try { _gpsLocation = await _gpsLocatorService.GetCurrentLocationAsync(); } catch (GpsNotFoundException) { LocationText = "Your position cound not be located"; return; } try { LocationText = await _gpsLocatorService.GetCivilAddressAsync(); } catch (UnknownAddressException) { LocationText = string.Format("Your location cannot be identified but your GPS is {0:0.####} {1:0.####}", _gpsLocation.Latitude, _gpsLocation.Longitude); } await RefreshWeather(); }
/// <summary> /// Create New GPSLocation Record /// </summary> public bool InsertGPSLocation(string licenseId, int childid, int deviceid, string gpsLocation) { var location = new GpsLocation { LicenseId = licenseId, ChildId = childid, DeviceId = deviceid, Obs = "", Location = gpsLocation, Created = DateTime.UtcNow, Updated = DateTime.UtcNow, Version = "1.0" }; using (var context = new CustomerInfoRepository()) { context.CustomerGpsLocations.Add(location); try { context.SaveChanges(); return(true); } catch (Exception) { return(false); } } }
private void CalculateDownloadSize(Poi poi) { string text = ""; bool enableDownloadButton = false; if (poi?.Id >= (long)PoiId.FIRST_VALID_ID || poi?.Id == (long)PoiId.CURRENT_LOCATION) { float size; var newDistance = GetDownloadDistance(); if (_oldDedItem == null || newDistance > _oldDedItem.Distance) { var gpsLocation = new GpsLocation(poi.Longitude, poi.Latitude, poi.Altitude); var etc = new ElevationTileCollection(gpsLocation, newDistance); size = etc.GetSizeToDownload(); text = String.Format(Resources.GetText(Resource.String.DownloadED_ExpectedSizeDownload), $"{size:F1}"); enableDownloadButton = true; } else if (newDistance < _oldDedItem.Distance) { var location = new GpsLocation(_oldDedItem.Longitude, _oldDedItem.Latitude, 0); var tilesToBeRemovedAll = ElevationTileCollection.GetTilesForRemoval(location, _oldDedItem.Distance, newDistance); var tilesToBeRemovedUnique = ElevationTileCollection.GetUniqueTilesForRemoval(_oldDedItem.Id, _allElevationData, tilesToBeRemovedAll); size = tilesToBeRemovedUnique.GetSize() / 1024f / 1024f; text = String.Format(Resources.GetText(Resource.String.DownloadED_ExpectedSizeRemove), $"{size:F1}"); enableDownloadButton = true; } } FindViewById <TextView>(Resource.Id.textViewDownloadSize).Text = text; FindViewById <Button>(Resource.Id.buttonSave).Enabled = enableDownloadButton; }
private async Task PublishLastKnownLocationAsync(IObserver <IGpsLocation> observer) { try { var lastKnownLocation = await _proxy.GetLastKnownLocationAsync(); if (lastKnownLocation == null) { _analyticsService.Trace(this, "Last known location is null"); } else { var lastLocation = GpsLocation.Create(lastKnownLocation.Latitude, lastKnownLocation.Longitude); if (lastLocation.IsFailure) { _analyticsService.TraceError(this, lastLocation.Error, lastKnownLocation.ToObjectDictionary()); observer.OnError(new ErrorException(lastLocation.Error)); } else { _analyticsService.Trace(this, "Last known location published"); observer.OnNext(lastLocation.Value); } } } catch (Exception e) { _analyticsService.LogException(this, e); observer.OnError(new ErrorException(GeolocationErrors.Unexpected, e)); } }
/// <summary> /// Creates a new identity client. /// </summary> /// <param name="Name">Identity name.</param> /// <param name="Type">Identity type.</param> /// <param name="Location">Initial GPS location.</param> /// <param name="ImageMask">File name mask in the images folder that define which images can be randomly selected for profile image.</param> /// <param name="ImageChance">An integer between 0 and 100 that specifies the chance of each instance to have a profile image set.</param> public IdentityClient(string Name, string Type, GpsLocation Location, string ImageMask, int ImageChance) { log = new Logger("NetworkSimulator.IdentityClient", "[" + Name + "] "); log.Trace("(Name:'{0}',Type:'{1}',Location:{2},ImageMask:'{3}',ImageChance:{4})", Name, Type, Location, ImageMask, ImageChance); name = Name; type = Type; location = Location; extraData = null; bool hasImage = Helpers.Rng.NextDouble() < (double)ImageChance / 100; if (hasImage) { imageFileName = GetImageFileByMask(ImageMask); profileImage = imageFileName != null?File.ReadAllBytes(imageFileName) : null; } version = SemVer.V100; keys = Ed25519.GenerateKeys(); identityId = Crypto.Sha256(keys.PublicKey); messageBuilder = new PsMessageBuilder(0, new List <SemVer>() { SemVer.V100 }, keys); profileInitialized = false; hostingActive = false; log.Trace("(-)"); }
/*public static float GetBearing(GpsLocation myLocation, GpsLocation point) * { * var myLoc = GpsUtils.Convert(myLocation); * var poi = GpsUtils.Convert(point); * var x = myLoc.BearingTo(poi); * return x; * } * * public static float GetDistance(GpsLocation myLocation, GpsLocation point) * { * var myLoc = GpsUtils.Convert(myLocation); * var poi = GpsUtils.Convert(point); * var x = myLoc.DistanceTo(poi); * return x; * }*/ public static float GetAltitudeDifference(GpsLocation myLocation, GpsLocation point) { var diff = point.Altitude - myLocation.Altitude; float a = (float)diff; return(a); }
/// <summary> /// Copies values from signed profile information to properties of this instance of the identity. /// </summary> /// <param name="SignedProfile">Signed information about the profile.</param> /// <param name="HostingServerId">In case of NeighborhIdentity, this is set to network identifier of the hosting server.</param> public void CopyFromSignedProfileInformation(SignedProfileInformation SignedProfile, byte[] HostingServerId) { if (HostingServerId == null) { HostingServerId = new byte[0]; } ProfileInformation profile = SignedProfile.Profile; byte[] pubKey = profile.PublicKey.ToByteArray(); byte[] identityId = Crypto.Sha256(pubKey); GpsLocation location = new GpsLocation(profile.Latitude, profile.Longitude); this.IdentityId = identityId; this.HostingServerId = HostingServerId; this.PublicKey = pubKey; this.Version = profile.Version.ToByteArray(); this.Name = profile.Name; this.Type = profile.Type; this.InitialLocationLatitude = location.Latitude; this.InitialLocationLongitude = location.Longitude; this.ExtraData = profile.ExtraData; this.ProfileImage = profile.ProfileImageHash.Length != 0 ? profile.ProfileImageHash.ToByteArray() : null; this.ThumbnailImage = profile.ThumbnailImageHash.Length != 0 ? profile.ThumbnailImageHash.ToByteArray() : null; this.Signature = SignedProfile.Signature.ToByteArray(); }
protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data) { base.OnActivityResult(requestCode, resultCode, data); if (resultCode == PoiSelectActivity.RESULT_OK) { var id = data.GetLongExtra("Id", 0); var selectedPoint = (id == (long)PoiId.CURRENT_LOCATION) ? PoiSelectActivity.GetMyLocationPoi(AppContext) : AppContext.Database.GetItem(id); if (requestCode == PoiSelectActivity.REQUEST_SELECT_CAMERADIRECTION) { if (!TryGetGpsLocation(out GpsLocation location, false)) { PopupHelper.ErrorDialog(this, Resource.String.PhotoParameters_SetCameraLocationFirst); } var bearing = GpsUtils.QuickBearing(location, new GpsLocation(selectedPoint.Longitude, selectedPoint.Latitude, selectedPoint.Altitude)); UpdateHeading(bearing); } else if (requestCode == PoiSelectActivity.REQUEST_SELECT_CAMERALOCATION) { var location = new GpsLocation(selectedPoint.Longitude, selectedPoint.Latitude, selectedPoint.Altitude); UpdateCameraLocation(location); UpdateCameraAltitude(location); } } }
private static readonly short VALUE_SIZE = 2;//Bytes public static void ReadTiff(string filename, GpsLocation filterMin, GpsLocation filterMax, GpsLocation myLocation, int skipFactor, List <GpsLocation> eleData) { try { using (Tiff tiff = Tiff.Open(filename, "r")) { if (tiff == null) { throw new SystemException("File open error."); } var(width, height) = GetImageSize(tiff); var(pixelSizeX, pixelSizeY) = GetPixelSize(tiff); var startLocation = GetStartLocation(tiff); var scanline = new byte[tiff.ScanlineSize()]; for (int i = 0; i < height; i++) { tiff.ReadScanline(scanline, i); var latitude = startLocation.Latitude + (pixelSizeY * i); if (scanline.Length / 2 != width) { throw new SystemException("Invalid GeoTiff data"); } if (latitude >= filterMin.Latitude && latitude <= filterMax.Latitude) { for (var j = 0; j < scanline.Length / VALUE_SIZE; j++) { var longitude = startLocation.Longitude + (pixelSizeX * j); byte loByte = scanline[j * VALUE_SIZE + 0]; byte hiByte = scanline[j * VALUE_SIZE + 1]; var alt = hiByte * 256 + loByte; if (longitude >= filterMin.Longitude && longitude <= filterMax.Longitude) { if (i % skipFactor == 0 && j % skipFactor == 0) { var ep = new GpsLocation { Altitude = alt, Latitude = latitude, Longitude = longitude }; ep.QuickDistance(myLocation); ep.QuickBearing(myLocation); ep.GetVerticalViewAngle(myLocation); eleData.Add(ep); } } } } } } } catch (Exception ex) { throw new SystemException("GeoTiff parsing error", ex); } }
private async Task PublishCurrentLocationAsync(GeolocationRequest geolocationRequest, IObserver <IGpsLocation> observer, string description) { try { var currentLocation = await _proxy.GetCurrentLocationAsync(geolocationRequest); if (currentLocation == null) { _analyticsService.TraceWarning(this, $"{description} location is null"); } else { var currentGpsLocation = GpsLocation.Create(currentLocation.Latitude, currentLocation.Longitude); if (currentGpsLocation.IsFailure) { _analyticsService.TraceError(this, currentGpsLocation.Error, currentLocation.ToObjectDictionary()); observer.OnError(new ErrorException(currentGpsLocation.Error)); } else { _analyticsService.Debug($"{description} location published"); observer.OnNext(currentGpsLocation.Value); } } } catch (Exception e) { _analyticsService.LogException(this, e); observer.OnError(new ErrorException(GeolocationErrors.Unexpected, e)); } }
/// <summary> /// Initializes an instance of a profile server simulator. /// </summary> /// <param name="Name">Name of the instance.</param> /// <param name="IpAddress">IP address on which this server will listen.</param> /// <param name="BasePort">Base port from which specific interface port numbers are calculated.</param> /// <param name="Keys">Cryptographic keys of this server instance, or null if they should be generated.</param> /// <param name="Location">Location of the profile server.</param> public ProfileServer(string Name, IPAddress IpAddress, int BasePort, KeysEd25519 Keys = null, GpsLocation Location = null) { log = NLog.LogManager.GetLogger("Test.ProfileServer." + Name); log.Trace("(IpAddress:'{0}',BasePort:{1})", IpAddress, BasePort); keys = Keys != null ? Keys : Ed25519.GenerateKeys(); location = Location != null ? Location : new GpsLocation(0, 0); name = Name; ipAddress = IpAddress; primaryPort = BasePort; serverNeighborPort = BasePort + 1; clientNonCustomerPort = BasePort + 2; primaryListener = new TcpListener(ipAddress, primaryPort); primaryListener.Server.LingerState = new LingerOption(true, 0); primaryListener.Server.NoDelay = true; serverNeighborListener = new TcpListener(ipAddress, serverNeighborPort); serverNeighborListener.Server.LingerState = new LingerOption(true, 0); serverNeighborListener.Server.NoDelay = true; clientNonCustomerListener = new TcpListener(ipAddress, clientNonCustomerPort); clientNonCustomerListener.Server.LingerState = new LingerOption(true, 0); clientNonCustomerListener.Server.NoDelay = true; tlsCertificate = new X509Certificate2("ps.pfx"); messageList = new List <IncomingServerMessage>(); log.Trace("(-)"); }
public static async Task <PlaceInfo> AsyncGetPlaceName(GpsLocation location) { //https://docs.microsoft.com/en-us/xamarin/essentials/geocoding?tabs=android try { var loc = new Xamarin.Essentials.Location(location.Latitude, location.Longitude); var placemarks = await Geocoding.GetPlacemarksAsync(loc); var placemark = placemarks?.FirstOrDefault(); if (placemark != null) { var geocodeAddress = placemark.Thoroughfare; geocodeAddress = geocodeAddress.Append(" ", placemark.SubThoroughfare); geocodeAddress = geocodeAddress.Append(", ", placemark.SubLocality); geocodeAddress = geocodeAddress.Append(", ", placemark.Locality); geocodeAddress = geocodeAddress.Append(", ", placemark.CountryCode); var country = PoiCountryHelper.GetCountry(placemark.CountryCode) ?? PoiCountryHelper.GetDefaultCountryByPhoneSettings(); return(new PlaceInfo(geocodeAddress, country)); } return(new PlaceInfo()); } catch { return(new PlaceInfo()); } }
public static Visibility IsPoiVisible(PoiViewItem item, ElevationProfileData elevationProfileData) { if (elevationProfileData == null) { return(Visibility.Visible); } var leftPoints = elevationProfileData.GetData((int)item.GpsLocation.Bearing); var rightPoints = elevationProfileData.GetData((int)GpsUtils.Normalize360(item.GpsLocation.Bearing.Value + 1)); if (leftPoints == null || rightPoints == null) { return(Visibility.Visible); } var maxLeft = new GpsLocation() { VerticalViewAngle = -100, Distance = 100 }; var leftPoints2 = leftPoints.GetPoints().Where(p => p.Distance < item.GpsLocation.Distance); if (leftPoints2.Any()) { maxLeft = leftPoints2.Aggregate((max, item2) => item2?.VerticalViewAngle > max?.VerticalViewAngle ? item2 : max); } var maxRight = new GpsLocation() { VerticalViewAngle = -100, Distance = 100 }; var rightPoints2 = rightPoints.GetPoints().Where(p => p.Distance < item.GpsLocation.Distance); if (rightPoints2.Any()) { maxRight = rightPoints2.Aggregate((max, item2) => item2?.VerticalViewAngle > max?.VerticalViewAngle ? item2 : max); } var maxViewAngle = maxRight.VerticalViewAngle > maxLeft.VerticalViewAngle ? maxRight : maxLeft; var itemViewAngle = item.VerticalViewAngle; var viewAngleDiff = item.VerticalViewAngle - maxViewAngle.VerticalViewAngle; var viewAngleDistance = item.GpsLocation.Distance - maxViewAngle.Distance; var viewAngleVisibilityLimit = -(itemViewAngle * 0.01 + 0.0); var viewAnglePartVisibilityLimit = -(itemViewAngle * 0.2 + 1.0); var distancePartVisibilityLimit = 2000;//m if (viewAngleDiff > viewAngleVisibilityLimit) { return(Visibility.Visible); } if (viewAngleDiff > viewAnglePartVisibilityLimit && viewAngleDistance < distancePartVisibilityLimit) { return(Visibility.PartialyVisible); } return(Visibility.Invisible); }
public void GenerateElevationProfile3(GpsLocation myLocation, double visibility, ElevationProfileData elevationData, Action <int> onProgressChange) { _elevationProfileData = new ElevationProfileData(myLocation, visibility); int progress = 0; foreach (var group in elevationData.GetData()) { progress++; onProgressChange(progress); var points = group.GetPoints() .Where(i => i.Distance > MIN_DISTANCE && i.Distance < visibility * 1000) .OrderBy(i => i.Distance); //Select visible points List <GpsLocation> tmpVisiblePoints = new List <GpsLocation>(); double maxViewAngle = -90; foreach (var point in points) { if (point.VerticalViewAngle > maxViewAngle) { tmpVisiblePoints.Add(point); maxViewAngle = point.VerticalViewAngle.Value; } } //Change order (now from the furthest to the nearest) tmpVisiblePoints.Reverse(); //... and ignore points on descending slope GpsLocation lastPoint = null; GpsLocation lastAddedPoint = null; var ed = new ElevationData(group.Angle); foreach (var point in tmpVisiblePoints) { if (lastPoint == null) { ed.Add(point); lastAddedPoint = point; lastPoint = point; continue; } //TODO: comment-out the folowing if for full rendering var distanceDiff = lastPoint.Distance.Value - point.Distance.Value; if (distanceDiff < lastPoint.Distance / 100 + 50) { lastPoint = point; continue; } ed.Add(point); lastAddedPoint = point; lastPoint = point; } _elevationProfileData.Add(ed); } }
public void IF_string_is_invalid_SHOULD_fail(string serializedLocation) { //Act var result = GpsLocation.Parse(serializedLocation); //Assert Assert.That(result.IsFailure); }
public PoiViewItem(Poi poi) { Poi = poi; GpsLocation = new GpsLocation() { Latitude = this.Poi.Latitude, Longitude = this.Poi.Longitude, Altitude = this.Poi.Altitude }; }
public void QuickGetGeoLocation(double inLon, double inLat, double distance, double angle, double expLon, double expLat) { GpsLocation a = new GpsLocation(inLon, inLat, 0); var b = GpsUtils.QuickGetGeoLocation(a, distance, angle); Assert.AreEqual(expLat, Math.Round(b.Latitude * 100) / 100); Assert.AreEqual(expLon, Math.Round(b.Longitude * 100) / 100); }
public void Default_ToString() { var sut = new GpsLocation(5, 10); var text = sut.ToString(); text.Should().Contain(5m.ToString()); text.Should().Contain(10m.ToString()); }
public void Default_ToString_With_Culture() { var sut = new GpsLocation(5, 10); var text = sut.ToString(null, CultureInfo.InvariantCulture); text.Should().Contain(5m.ToString(null, CultureInfo.InvariantCulture)); text.Should().Contain(10m.ToString(null, CultureInfo.InvariantCulture)); }
public void Parse_Degrees_With_Comma_Decimal_Separator_Not_Allowed_To_Use_Comma_As_Separator() { var location = "-41,95,12,45"; Action action = () => GpsLocation.Parse(location, CultureInfo.GetCultureInfo(1043)); action.Should().Throw <ArgumentException>(); }
public void Use_FormatString_In_ToString() { var sut = new GpsLocation(5.5555, 10.5555); var text = sut.ToString("N2", CultureInfo.InvariantCulture); text.Should().Contain(5.5555m.ToString("N2", CultureInfo.InvariantCulture)); text.Should().Contain(10.5555m.ToString("N2", CultureInfo.InvariantCulture)); }
internal PoiViewItem GetNearestPoi(GpsLocation loc, IGpsUtilities iGpsUtilities) { var candidates = GetItems(loc, 0.2); List <PoiViewItem> items = new PoiViewItemList(candidates, loc, iGpsUtilities); var item = items.OrderBy(x => x.GpsLocation.Distance).FirstOrDefault(); return(item); }
public static int SynchGpsLocation (GpsLocation item) { return ETCDbRepository.SynchLocation (item); }
public static void DeleteGPS(GpsLocation item) { me.db.Delete<GpsLocation> (item); }
public static int SynchLocation(GpsLocation item) { var location = me.db.GetItem<GpsLocation> (item.Id); location.isSynched = 1; return SaveLocation (location); }
public static int SaveLocation(GpsLocation item) { return me.db.SaveItem<GpsLocation> (item); }
public static void DeleteLocation (GpsLocation item) { ETCDbRepository.DeleteGPS (item); }
public static int SaveLocation (GpsLocation item) { return ETCDbRepository.SaveLocation (item); }