public void setMapInfo(double swLat, double swLng, double neLat, double neLng) { var sw = new GeoCoordinates(swLat, swLng); var ne = new GeoCoordinates(neLat, neLng); ViewModels.MainWindowViewModel.Instance.LocationBoundsSettingToSave = new LatLngBounds(sw, ne); }
private SniperInfo map(Result result) { SniperInfo sniperInfo = new SniperInfo(); PokemonId pokemonId = PokemonParser.parsePokemon(result.name); if (!pokemonIdsToFind.Contains(pokemonId)) { return(null); } sniperInfo.Id = pokemonId; GeoCoordinates geoCoordinates = GeoCoordinatesParser.parseGeoCoordinates(result.coords); if (geoCoordinates == null) { return(null); } else { sniperInfo.Latitude = geoCoordinates.latitude; sniperInfo.Longitude = geoCoordinates.longitude; } sniperInfo.ExpirationTimestamp = Convert.ToDateTime(result.until); return(sniperInfo); }
/// <summary> /// Return the HashCode of this object. /// </summary> /// <returns>The HashCode of this object.</returns> public override Int32 GetHashCode() { unchecked { return(AuthorizationStatus.GetHashCode() * 23 ^ GeoCoordinates.GetHashCode() * 19 ^ (ChargingStationName != null ? ChargingStationName.GetHashCode() * 17 : 0) ^ (Address != null ? Address.GetHashCode() * 13 : 0) ^ (SessionId.HasValue ? SessionId.Value.GetHashCode() * 11 : 0) ^ (StatusCode != null ? StatusCode.GetHashCode() * 7 : 0) ^ (TermsOfUse != null ? TermsOfUse.GetHashCode() * 5 : 0) ^ (AdditionalInfo != null ? AdditionalInfo.GetHashCode() * 3 : 0)); } }
/// <summary> /// Compares two mobile authorization start for equality. /// </summary> /// <param name="MobileAuthorizationStart">A mobile authorization start to compare with.</param> /// <returns>True if both match; False otherwise.</returns> public override Boolean Equals(MobileAuthorizationStart MobileAuthorizationStart) { if ((Object)MobileAuthorizationStart == null) { return(false); } return(AuthorizationStatus.Equals(MobileAuthorizationStart.AuthorizationStatus) && GeoCoordinates.Equals(MobileAuthorizationStart.GeoCoordinates) && ((ChargingStationName != null && MobileAuthorizationStart.ChargingStationName != null) || (ChargingStationName == null && MobileAuthorizationStart.ChargingStationName == null && ChargingStationName.Equals(MobileAuthorizationStart.ChargingStationName))) && ((Address != null && MobileAuthorizationStart.Address != null) || (Address == null && MobileAuthorizationStart.Address == null && Address.Equals(MobileAuthorizationStart.Address))) && ((!SessionId.HasValue && !MobileAuthorizationStart.SessionId.HasValue) || (SessionId.HasValue && MobileAuthorizationStart.SessionId.HasValue && SessionId.Value.Equals(MobileAuthorizationStart.SessionId.Value))) && ((StatusCode != null && MobileAuthorizationStart.StatusCode != null) || (StatusCode == null && MobileAuthorizationStart.StatusCode == null && StatusCode.Equals(MobileAuthorizationStart.StatusCode))) && ((TermsOfUse != null && MobileAuthorizationStart.TermsOfUse != null) || (TermsOfUse == null && MobileAuthorizationStart.TermsOfUse == null && TermsOfUse.Equals(MobileAuthorizationStart.TermsOfUse))) && ((AdditionalInfo != null && MobileAuthorizationStart.AdditionalInfo != null) || (AdditionalInfo == null && MobileAuthorizationStart.AdditionalInfo == null && AdditionalInfo.Equals(MobileAuthorizationStart.AdditionalInfo)))); }
public void LocationSelectionView(GeoCoordinates startLocation, Action <NamedLocation> locationSelectedCallback) { if (!SetState(ViewState.LocationSelection)) { return; } homeSearchBarLocationCallback = null; homeLongPressCallback = null; this.locationSelectedCallback = locationSelectedCallback; Map.HasZoomEnabled = true; Map.HasScrollEnabled = true; Map.IsShowingUser = true; searchBar.IsVisible = true; confirmButton.IsVisible = locationSelectedCallback != null; rideInProgressControls.IsVisible = false; Map.MoveToMapRegion(MapSpan.FromCenterAndRadius(startLocation.ToTKPosition(), new Distance(500)), true); Map.Pins = new TKCustomMapPin[] { new TKCustomMapPin { Position = startLocation.ToTKPosition(), IsDraggable = true } }; Map.Polylines = new TK.CustomMap.Overlays.TKPolyline[] { }; }
static (IList <MatchableRideRequest>, RideInfo) RideWithPassenger(UserRideOffer offer, MatchableRideRequest request) { GeoCoordinates offerOrig = offer.RideOffer.Trip.Source; GeoCoordinates offerDest = offer.RideOffer.Trip.Destination; GeoCoordinates requestOrig = request.Request.RideRequest.Trip.Source; GeoCoordinates requestDest = request.Request.RideRequest.Trip.Destination; Task <RouteInfo> leg1Task = Task.Run(() => GetRouteBetween(offerOrig, requestOrig)); Task <RouteInfo> leg2Task = Task.Run(() => GetRouteBetween(requestOrig, requestDest)); Task <RouteInfo> leg3Task = Task.Run(() => GetRouteBetween(requestDest, offerDest)); IReadOnlyList <GeoCoordinates> leg1Points = leg1Task.Result.overviewPolyline.Points; IReadOnlyList <GeoCoordinates> leg2Points = leg2Task.Result.overviewPolyline.Points; IReadOnlyList <GeoCoordinates> leg3Points = leg3Task.Result.overviewPolyline.Points; IEnumerable <Route.Stop> stops = leg1Points.SkipLast(1).Select(pt => new Route.Stop(pt)).Concat( leg2Points.Take(1).Select(pt => new Route.Stop(pt, request.Request.User.UserInfo, true))).Concat( leg2Points.Skip(1).SkipLast(1).Select(pt => new Route.Stop(pt))).Concat( leg3Points.Take(1).Select(pt => new Route.Stop(pt, request.Request.User.UserInfo, false))).Concat( leg3Points.Skip(1).Select(pt => new Route.Stop(pt))); return( new List <MatchableRideRequest> { request }, new RideInfo(offer.User.UserInfo.UserId, offer.RideOffer.Car, new Route(stops))); }
public async Task <IActionResult> Run( [HttpTrigger(AuthorizationLevel.Function, "get", Route = null)] HttpRequest req, ILogger log) { log.LogInformation("C# HTTP trigger function processed a request."); if (req.Query.TryGetValue("latitude", out StringValues latitude) && req.Query.TryGetValue("longitude", out StringValues longitude) ) { if (double.TryParse(latitude, out double dLatitude) && double.TryParse(longitude, out double dLongitude)) { GeoCoordinates geoCoordinates = new GeoCoordinates() { Latitude = dLatitude, Longitude = dLongitude }; var result = await this.WeatherService.GetCurrentWeatherAsync(geoCoordinates); return(new OkObjectResult(result)); } } string name = req.Query["name"]; string requestBody = await new StreamReader(req.Body).ReadToEndAsync(); dynamic data = JsonConvert.DeserializeObject(requestBody); name = name ?? data?.name; string responseMessage = string.IsNullOrEmpty(name) ? "This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response." : $"Hello, {name}. This HTTP triggered function executed successfully."; return(new OkObjectResult(responseMessage)); }
public static GeoCoordinates CalculateOffset(GeoCoordinates origin, GeoCoordinates other) { double latOff = other.latitude - origin.latitude; double lonOff = other.longitude - origin.longitude; return(new GeoCoordinates(latOff, lonOff)); }
public override void Convert(ADRawEntry adObject, IStorePropertyBag contact) { Util.ThrowOnNullArgument(adObject, "adObject"); Util.ThrowOnNullArgument(contact, "contact"); object obj; if (adObject.TryGetValueWithoutDefault(ADRecipientSchema.GeoCoordinates, out obj)) { GeoCoordinates geoCoordinates = (GeoCoordinates)obj; contact[ContactSchema.HomeLatitude] = geoCoordinates.Latitude; contact[ContactSchema.HomeLongitude] = geoCoordinates.Longitude; contact[ContactSchema.HomeLocationSource] = LocationSource.Contact; if (geoCoordinates.Altitude != null) { contact[ContactSchema.HomeAltitude] = geoCoordinates.Altitude; } else { ADPersonToContactConverter.Tracer.TraceDebug(0L, "Deleting contact HomeAltitude property it is not found on AD GeoCoordinates property."); contact.Delete(ContactSchema.HomeAltitude); } ADPersonToContactConverter.GeoCoordinatesConverter.locationUriConverter.Convert(adObject, contact); return; } ADPersonToContactConverter.Tracer.TraceDebug(0L, "Deleting contact location properties since AD GeoCoordinates property not found."); contact.Delete(ContactSchema.HomeLatitude); contact.Delete(ContactSchema.HomeLongitude); contact.Delete(ContactSchema.HomeLocationSource); contact.Delete(ContactSchema.HomeAltitude); ADPersonToContactConverter.GeoCoordinatesConverter.locationUriConverter.Convert(adObject, contact); }
static void OnUserLocationUpdated(User user, GeoCoordinates newLocation) { if (userIdToQuadtreeElement.TryGetValue(user.UserInfo.UserId, out UserElement element)) { activeUsers.MoveElement(element, newLocation); } }
public void GeoCoordinateInitsWithNoArgs() { var geoCoordinates = new GeoCoordinates(); Assert.NotNull(geoCoordinates); Assert.IsType <GeoCoordinates>(geoCoordinates); }
public T ReverseGeocoding(GeoCoordinates location) { return(_client.GetRequest <T>(new Dictionary <string, string>() { { "latlng", location.ToString() } })); }
private void getPlaces() { GeoCoordinates geoLL; string strConnectionString = ConfigurationManager.ConnectionStrings["Foreigners@SGString"].ConnectionString; SqlConnection myConnect = new SqlConnection(strConnectionString); string strCommandText = "SELECT placename, count(placename) FRom facebook GROUP BY placename HAVING COUNT(placename) > 1"; SqlCommand cmd = new SqlCommand(strCommandText, myConnect); myConnect.Open(); SqlDataReader reader = cmd.ExecuteReader(); feed += "<a class='handle3' style='height: 220px !important;' href='http://link-for-non-js-users.html'>Content</a> <div id='nt-example3-container'> <ul style='margin-right: 30px;' id='nt-example3'>"; while (reader.Read()) { pn = reader["placename"].ToString(); feed += "<li style='font-size: 10pt;'>" + pn + "</li>"; } XmlDocument xDoc = new XmlDocument(); xDoc.Load("https://maps.googleapis.com/maps/api/geocode/xml?address=" + pn + "&sensor=false®ion=sg"); lat = xDoc.SelectSingleNode("/GeocodeResponse/result/geometry/location/lat").InnerText; lng = xDoc.SelectSingleNode("/GeocodeResponse/result/geometry/location/lng").InnerText; geoLL = new GeoCoordinates(double.Parse(lng.TrimStart()), double.Parse(lat), true); //zoomTo(\"" + geoLL.X + "\",\"" + geoLL.Y + "\"); mostvisitedplaces.InnerHtml = feed + " </div>" + " <span class='button' id='nt-example3-button' style='margin-left: 30px !important; '>START</span>"; }
/// <summary> /// Initializes a new instance of the <see cref="TwitterGeoLocation"/> struct. /// </summary> /// <param name="latitude">The latitude.</param> /// <param name="longitude">The longitude.</param> public TwitterGeoLocation(double latitude, double longitude) { _coordinates = new GeoCoordinates { Latitude = latitude, Longitude = longitude }; }
public Place(PostalAddress address, GeoCoordinates geo, string description, ImageObject image, string name) { Address = address; Geo = geo; Description = description; Image = image; Name = name; }
private void testCoordinates(String text, Double expectedLatitude, Double expectedLongitude) { GeoCoordinates geoCoordinates = GeoCoordinatesParser.parseGeoCoordinates(text); Assert.IsNotNull(geoCoordinates); Assert.AreEqual(expectedLatitude, geoCoordinates.latitude); Assert.AreEqual(expectedLongitude, geoCoordinates.longitude); }
void OnMapLongPress(GeoCoordinates location) { tagRideMap.LocationSelectionView(location, (loc) => { tagRideMap.PureMapView(); MakeRideOrOfferTo(loc).FireAndForgetAsync(App.Current.ErrorHandler); }); }
internal async Task RenderLines(GeoCoordinates routeStart, GeoCoordinates routeEnd, GeoCoordinates[] pointsInRoute) { var module = await this.moduleTask.Value; await module.InvokeVoidAsync("RenderLine", routeStart, routeEnd, pointsInRoute ); }
public override void Execute(SharedObjects shared) { double longitude = GetDouble(shared.Cpu.PopValue()); double latitude = GetDouble(shared.Cpu.PopValue()); GeoCoordinates result = new GeoCoordinates(shared.Vessel, latitude, longitude); shared.Cpu.PushStack(result); }
public async Task <string> PostFakeRideRequestAsync(GeoCoordinates source, GeoCoordinates destination) { Random rand = new Random(); string userId = $"fakepeshin-{rand.Next()}"; return(await PostRideRequestAsync(userId, new RideRequest( new Trip(DateTime.Now, source, destination), new RequestGameElements(null)))); }
public void FullEarthRectContainsAverageSegment() { Rect fullEarth = GetFullEarthRect(); GeoCoordinates segA = new GeoCoordinates(0, -10); GeoCoordinates segB = new GeoCoordinates(10, 10); GeoSegment seg = new GeoSegment(segA, segB); Assert.True(GeoRectUtils.RectNearSegment(seg, fullEarth, 0)); }
public void FullEarthRectContainsSegmentCrossingPrimeMeridian() { Rect fullEarth = GetFullEarthRect(); GeoCoordinates segA = new GeoCoordinates(-10, 170); GeoCoordinates segB = new GeoCoordinates(10, 190); GeoSegment seg = new GeoSegment(segA, segB); Assert.True(GeoRectUtils.RectNearSegment(seg, fullEarth, 0)); }
public String BuildCoordinatesString(GeoCoordinates coordinates) { if (coordinates == null) { return "null"; } else { return String.Format("{0}, {1}", coordinates.Latitude, coordinates.Longitude); } }
public override void Execute(SharedObjects shared) { double longitude = GetDouble(PopValueAssert(shared)); double latitude = GetDouble(PopValueAssert(shared)); AssertArgBottomAndConsume(shared); var result = new GeoCoordinates(shared, latitude, longitude); ReturnValue = result; }
internal Address( string city, string streetInfo, GeoCoordinates coordinates) { Validate(city, streetInfo); this.City = city; this.StreetInfo = streetInfo; this.Coordinates = coordinates; }
/// <summary> /// Return a JSON representation of this object. /// </summary> public JObject ToJSON() { if ((GeoCoordinates?.Any() != true) && Distance.HasValue) { return(JSONObject.Create( new JProperty("type", "circle"), new JProperty("radius", Distance.ToString()) )); } return(JSONObject.Create()); }
void OnConfirmClicked(object sender, EventArgs e) { if (state != ViewState.LocationSelection) { return; } Position loc = Map.Pins.First().Position; GeoCoordinates coord = new GeoCoordinates(loc.Latitude, loc.Longitude); locationSelectedCallback?.Invoke(new NamedLocation("Map Pin", coord)); }
///<summary> /// Suffix funtion for returing the Slope for a spot /// takes the kos parameters <BodyTarget>, <GeoCoordinates> ///</summary> public ScalarDoubleValue GetSlope(BodyTarget bodytgt, GeoCoordinates coordinate) { double slope = -1; double offsetm = 500; double lon = coordinate.Longitude; double lat = coordinate.Latitude; CelestialBody body = bodytgt.Body; if ((SCANWrapper.IsCovered(lon, lat, body, "AltimetryHiRes")) || ((HasKerbNet("Terrain") && (IsInKerbNetFoV(body, lon, lat))))) { offsetm = 5; } /* * double circum = body.Body.Radius * 2 * Math.PI; * double eqDistancePerDegree = circum / 360; * degreeOffset = 5 / eqDistancePerDegree; */ double offset = offsetm / (body.Radius * 2 * Math.PI / 360); double latOffset = 0; // matrix for z-values double[] z = new double[9]; int i = 0; double altcenter = GetAltAt(body, lon, lat); // setup the matrix with eqidistant messurement. // We have now the form from: // http://www.caee.utexas.edu/prof/maidment/giswr2011/docs/Slope.pdf // for (int lac = 1; lac > -2; lac--) { latOffset = offset * Math.Cos(Mathf.Deg2Rad * lat); for (int lnc = -1; lnc < 2; lnc++) { z[i] = GetAltAt(body, lon + (lnc * latOffset), lat + (lac * offset)); if (z[i] == -1) { z[i] = altcenter; } i = +1; } } double dEW = ((z[0] + z[3] + z[6]) - (z[2] + z[5] + z[8])) / (8 * offsetm); double dNS = ((z[6] + z[7] + z[8]) - (z[0] + z[1] + z[2])) / (8 * offsetm); slope = 100 * Math.Abs(Math.Sqrt(Math.Pow(dEW, 2) + Math.Pow(dNS, 2))); return(Math.Round(slope, 2)); }
private bool IsFoundAddress(GeoCoordinates location) { GeocodingResponse response = FindAddress(location); bool is_found = IsStatusOk(response.Status); if (!is_found) { Console.WriteLine($"Address of location: {location.ToString()} is not found: {response.Status}"); } return(is_found); }
public override List <IGeoCoordinates> Parse(string segyPath) { if (!File.Exists(segyPath)) { throw new FileNotFoundException($"File {segyPath} does not exist"); } using (BinaryReader reader = new BinaryReader(File.Open(segyPath, FileMode.Open))) { var textBytes = reader.ReadBytes(TextBytesOffset); var text = Encoding.UTF8.GetString(textBytes); if (text.Contains(Gpr)) { PayloadType = Gpr; } else if (text.Contains(EchoSounder)) { PayloadType = EchoSounder; } else { PayloadType = Unknown; throw new UnknownSegyTypeException($"Not supported SEG-Y type: {PayloadType}"); } } using (BinaryReader reader = new BinaryReader(File.Open(segyPath, FileMode.Open))) { TracesLength = BitConverter.ToInt16(reader.ReadBytes(SamplesPerTraceOffset).Skip(SamplesPerTraceOffset - sizeof(short)).Take(sizeof(short)).ToArray(), 0); } var coordinates = new List <IGeoCoordinates>(); using (BinaryReader reader = new BinaryReader(File.Open(segyPath, FileMode.Open))) { var samples = (SegYSampleFormat)BitConverter.ToInt16(reader.ReadBytes(SamplesFormatOffset).Skip(SamplesFormatOffset - sizeof(short)).Take(sizeof(short)).ToArray(), 0); SampleFormatBytes = samples == SegYSampleFormat.IbmFloat32BitFormat || samples == SegYSampleFormat.Integer32BitFormat ? 4 : 2; var data = reader.ReadBytes((int)reader.BaseStream.Length).Skip(HeadersOffset - SamplesFormatOffset).ToArray(); for (int i = 0; i < data.Length; i += TraceHeaderOffset + TracesLength * SampleFormatBytes) { if (i + TraceHeaderOffset > data.Length) { break; } GeoCoordinates coordinate = PayloadType switch { Gpr => CreateGprCoordinates(data, i), EchoSounder => CreateEchoSounderCoordinates(data, i), _ => throw new Exception($"Not supported SEG-Y type: {PayloadType}"), }; coordinates.Add(coordinate); } } return(coordinates); }
public async Task <ActionResult> PostLocation([FromBody] GeoCoordinates location, [FromQuery] string userId) { User user = await Users.GetUser(userId); if (user == null) { return(NotFound()); } user.LastKnownLocation = location; return(Ok()); }
public Order Create(OrderDto dto) { var coordsFrom = new GeoCoordinates { Latitude = Convert.ToDouble(dto.GeoCoordinatesFromLat), Longitude = Convert.ToDouble(dto.GeoCoordinatesFromLng) }; //var addressFrom = Db.Addresses.FirstOrDefault(a => a.Coords == coordsFrom); var coordsTo = new GeoCoordinates { Latitude = Convert.ToDouble(dto.GeoCoordinatesToLat), Longitude = Convert.ToDouble(dto.GeoCoordinatesToLng) }; //var addressTo = Db.Addresses.FirstOrDefault(a => a.Coords == coordsTo); var client = String.IsNullOrEmpty(dto.ClientId) ? null : Db.Clients.FirstOrDefault(c => c.Id == dto.ClientId); var order = new Order { AddressFrom = new Address //addressFrom ?? new Address { Coords = coordsFrom, Name = dto.AddressFrom }, AddressTo = new Address //addressTo ?? new Address { Coords = coordsFrom, Name = dto.AddressFrom }, Client = client, }; return order; }
public void UpdateTravelerCoordinates(Traveler traveler, GeoCoordinates coords) { }