void OnLocationUpdate(object sender, LocationUpdatedEventArgs e) { var coordinate = e.Location.Coordinate; var accuracy = (float)e.Location.HorizontalAccuracy; marker.ShowAt(coordinate.Latitude, coordinate.Longitude, accuracy); }
public void HandleLocationChanged(object sender, LocationUpdatedEventArgs e) { if (Connectivity.NetworkAccess != NetworkAccess.Internet) { return; } if (DateTime.Now.Subtract(_lastUpdateTime) < TimeSpan.FromSeconds(10)) { return; } var token = App.User.UserToken; if (token == null) { return; } try { UpdateLocation(token, e); _lastUpdateTime = DateTime.Now; } catch (Exception exception) { Console.WriteLine(exception); } }
private void core_LocationUpdatedEventHandler(object sender, LocationUpdatedEventArgs e) { if (e.IsValid) { double course_deg = double.NaN; if (e.ID == "RWLT (FLT)") { if (core.TargetCourse.IsInitialized) { course_deg = core.TargetCourse.Value; } logger.Write(string.Format(CultureInfo.InvariantCulture, "TLOC: LAT={0:F06}°, LON={1:F06}°, DPT={2}, Valid={3}", e.Latitude, e.Longitude, double.IsNaN(e.Depth) ? "undefined" : string.Format(CultureInfo.InvariantCulture, "{0:F03} m", e.Depth), e.IsValid)); } else if (e.ID == "AUX GNSS") { if (core.AUXTrack.IsInitialized) { course_deg = core.AUXTrack.Value; } } AddTrackPoint(e.ID, e.Latitude, e.Longitude, e.Depth, e.TimeStamp, course_deg); } if (isAutoscreenshot) { InvokeSaveFullScreenshot(); } }
public bool Accept(LocationUpdatedEventArgs evt) { var now = DateTime.UtcNow; var then = evt.Timestamp; return((now - then) <= maxAge); }
public void UpdateData(object sender, LocationUpdatedEventArgs e) { if (started) { if (ViewController.debugPrint) { Console.WriteLine("::Data::"); } if (data == null) { if (ViewController.debugPrint) { Console.WriteLine("::Data is null::"); } try { data = new Data(locationManager.Location.Coordinate);//Initiallized data with the starting coordinate } catch { data = new Data(new CLLocationCoordinate2D(0, 0));//Initiallized data with the starting coordinate } } data.Add(e.Location.Coordinate); //Adds each coordinate to the list in data } }
void LocationProvider_OnLocationUpdated(object sender, LocationUpdatedEventArgs e) { if (_isInitialized) { _targetPosition = Conversions.GeoToWorldPosition(e.Location, _map.CenterMercator, _map.WorldRelativeScale).ToVector3xz(); if (balls == null) { balls = new Balls(); balls.balls = new List <Ball>(8); double lat_increment = -0.0001529; double lng_increment = -0.0000414; for (int i = 1; i < 9; i++) { Ball ball = new Ball(); ball.id = i.ToString(); ball.catched = "0"; ball.game = "1"; ball.user = "******"; ball.lat = (e.Location.x + lat_increment * i).ToString(); ball.lng = (e.Location.y + lng_increment * i).ToString(); balls.balls.Add(ball); } UpdateBallsPosition(); } } }
public void HandleLocationChanged(object sender, LocationUpdatedEventArgs e) { // Handle foreground updates CLLocation location = e.Location; Debug.WriteLine(location.Coordinate.Longitude.ToString()); Console.WriteLine("foreground updated"); }
private void OnLocationUpdated(object source, LocationUpdatedEventArgs args) { var marker = _myLocationMarker; if (marker != null) { marker.Position = args.Location.ToLatLng(); } }
void LocationProvider_OnLocationUpdated(object sender, LocationUpdatedEventArgs e) { if (_isInitialized) { _targetPosition = Conversions.GeoToWorldPosition(e.Location, _map.CenterMercator, _map.WorldRelativeScale).ToVector3xz(); } }
public void HandleLocationChanged(object sender, LocationUpdatedEventArgs e) { CLLocation location = e.Location; curLocation = e.Location; string lng = location.Coordinate.Longitude.ToString(); string lat = location.Coordinate.Latitude.ToString(); //Console.WriteLine($"Location Updated: {lng},{lat}"); }
//This will keep going in the background and the foreground public void PrintLocation(object sender, LocationUpdatedEventArgs e) { CLLocation location = e.Location; Console.WriteLine("Altitude: " + location.Altitude + " meters"); Console.WriteLine("Longitude: " + location.Coordinate.Longitude); Console.WriteLine("Latitude: " + location.Coordinate.Latitude); Console.WriteLine("Course: " + location.Course); Console.WriteLine("Speed: " + location.Speed); }
void LocationProvider_OnLocationUpdated(object sender, LocationUpdatedEventArgs e) { if (MapController.ReferenceTileRect == null) { return; } _targetPosition = Conversions.GeoToWorldPosition(e.Location, MapController.ReferenceTileRect.Center, MapController.WorldScaleFactor).ToVector3xz(); }
void LocationProvider_OnLocationUpdated(object sender, LocationUpdatedEventArgs e) { if (_isInitialized) { //Debug.Log(e.Location); _targetPosition = Conversions.GeoToWorldPosition(e.Location, _map.CenterMercator, _map.WorldRelativeScale).ToVector3xz(); //player.GetComponent<PositionWithLocationProvider>().setTargetPosition(_targetPosition); } }
public bool Accept(LocationUpdatedEventArgs evt) { if (evt.Accuracy != 0) { return(evt.Accuracy < maxAccuracy); } else { return(true); } }
public bool Accept(LocationUpdatedEventArgs evt) { foreach (var filter in filters) { if (!filter.Accept(evt)) { return(false); } } return(true); }
void LocationProvider_OnLocationUpdated(object sender, LocationUpdatedEventArgs e) { _targetPosition = Conversions.GeoToWorldPosition( e.Location, _map.CenterMercator, _map.WorldRelativeScale ).ToVector3xz() + mapOrigin.position; transform.position = Vector3.Lerp(transform.position, _targetPosition, Time.deltaTime * _positionFollowFactor); }
void LocationProvider_OnLocationUpdated(object sender, LocationUpdatedEventArgs e) { if (_isInitialized) { baseLocation = e.Location; _targetPosition = Conversions.GeoToWorldPosition(e.Location, _map.CenterMercator, _map.WorldRelativeScale).ToVector3xz(); Debug.Log("Obj: " + e.Location); _isInitialized = false; } }
void LocationProvider_OnLocationUpdated(object sender, LocationUpdatedEventArgs e) { if (_isInitialized) { _targetPosition = Conversions.GeoToWorldPosition(e.Location, _map.CenterMercator, _map.WorldRelativeScale).ToVector3xz(); if (!pokemonGenerated) { pokemonGenerated = true; pokemonFactory.PlacePokemon(e.Location); } } }
void LocationProvider_OnLocationUpdated(object sender, LocationUpdatedEventArgs e) { //Debug.Log ("change"); _isInitialized = true; if (_isInitialized) { _targetPosition = Conversions.GeoToWorldPosition(e.Location, _map.CenterMercator, _map.WorldRelativeScale).ToVector3xz(); } //Debug.Log (_isInitialized); //Debug.Log (_targetPosition); //Debug.Log (_map.CenterMercator); }
void LocationProvider_OnLocationUpdated(object sender, LocationUpdatedEventArgs e) { Console.Instance.Log(string.Format("Location: {0},{1}\tAccuracy: {2}\tHeading: {3}", e.Location.x, e.Location.y, e.Accuracy, _lastHeading), "lightblue"); var location = new Location(); location.Position = Conversions.GeoToWorldPosition(e.Location, _map.CenterMercator, _map.WorldRelativeScale).ToVector3xz(); location.Accuracy = e.Accuracy; _synchronizationContext.AddSynchronizationNodes(location, _arPositionReference.localPosition); }
private void HandleLocationChanged(object sender, LocationUpdatedEventArgs e) { // Handle foreground updates var location = e.Location; Altitude = location.Altitude; Longitude = location.Longitude; Latitude = location.Latitude; Course = location.Course; Speed = location.Speed; Mvx.TaggedTrace("LocationChanged", "LocationChanged", location); //Console.WriteLine("foreground updated"); }
// Trigger a LocationUpdateEvent. protected virtual void OnLocationUpdated(LocationUpdatedEventArgs args) { if (filters.Accept(args)) { log.LogDebug("Dispatch location update for {0}.", args.Name); var handler = LocationUpdated; if (handler != null) { handler(this, args); } } else { log.LogDebug("Filtered location update for {0}.", args.Name); } }
public void PrintLocation (object sender, LocationUpdatedEventArgs e) { CLLocation location = e.Location; flight.Data.GpsLatitude = location.Coordinate.Latitude; flight.Data.GpsLongitude = location.Coordinate.Longitude; JsonObject obj = new JsonObject(); obj.Add ("Time", DateTime.Now.ToString()); obj.Add ("Gps Latitude", location.Coordinate.Latitude); obj.Add ("Gps Longitude", location.Coordinate.Longitude); stream.Write (obj.ToString ()); stream.WriteLine (); }
private async void UpdateLocation(UserToken token, LocationUpdatedEventArgs e) { // Handle foreground updates var location = e.Location; var service = new LocationService(); var loc = new Location(location.Coordinate.Longitude, location.Coordinate.Latitude); if (App.User.IsGuard) { await service.UpdateCurrentLocationTask(loc, token, _bidGuid); } else { await service.AddPointOnMapTask(loc, token, _bidGuid); } }
void LocationProvider_OnLocationUpdated(object sender, LocationUpdatedEventArgs e) { if (_isInitialized) { curLoc = e.Location; _targetPosition = Conversions.GeoToWorldPosition(e.Location, _map.CenterMercator, _map.WorldRelativeScale).ToVector3xz(); if (temp) { GameObject.FindGameObjectWithTag("ObjectManager").GetComponent <ObjectManager>().SetBaseLocation(e.Location); transform.position = _targetPosition; temp = false; } } }
void LocationProvider_OnLocationUpdated(object sender, LocationUpdatedEventArgs e) { if (_isInitialized) { Debug.Log("asddsa"); _targetPosition = Conversions.GeoToWorldPosition(e.Location, _map.CenterMercator, _map.WorldRelativeScale).ToVector3xz(); //Debug.Log("is mark 전"); /* * if (_isMark) * { * * Debug.Log("is mark!!"); * * Mouse_Control = FindObjectOfType<Mouse_Touch>(); * SData = FindObjectOfType<ShopData>(); * shops = new GameObject[SData.datamanager.Count]; * shops_Position = new Vector3[SData.datamanager.Count]; * type = new string[SData.datamanager.Count]; * * for (int i = 0; i < SData.datamanager.Count; i++) * { * //shops[i] = shop; * shops[i] = GameObject.Find(SData.datamanager[i].type); * shops[i].name = SData.datamanager[i].shop_name + "_" + SData.datamanager[i].shop_id; * shops_Position[i] = Conversions.GeoToWorldPosition(double.Parse(SData.datamanager[i].lat), double.Parse(SData.datamanager[i].lon), * _map.CenterMercator, * _map.WorldRelativeScale).ToVector3xz(); * shops_Position[i].y += 4; * * Mouse_Control.setShopinfo(SData.datamanager[i].shop_id.ToString(), SData.datamanager[i].shop_info_id); * * Instantiate(shops[i], shops_Position[i], Quaternion.identity); * shops[i].name = SData.datamanager[i].type; * } * * _isMark = false; * * } */ } }
/// <summary> /// Notifies the location update. /// </summary> /// <param name="locationArgs">Location arguments.</param> protected void NotifyLocationUpdate(LocationUpdatedEventArgs locationArgs) { var location = locationArgs.Location; var newLocation = new Location() { Longitude = location.Longitude, Latitude = location.Latitude, Timestamp = DateTime.Now, }; CurrentLocation = newLocation; Locations.Add(newLocation); LocationUpdate?.Invoke(this, newLocation); // stop any more location updates LocationManager.Stop(); LocationLoading = false; }
public void HandleLocationChanged(object sender, LocationUpdatedEventArgs e) { CLLocation loc = e.Location; int speed = (int)(Math.Round(loc.Speed * MPH)); if (speed >= 0) { if (speed > maxSpeed) { maxSpeed = speed; Console.WriteLine("New max speed: " + speed); } if (speed != lastSpeed) { Console.WriteLine("Speed Added to queue: " + speed); speeds.Enqueue(speed); } lastSpeed = speed; } }
void LocationProvider_OnLocationUpdated(object sender, LocationUpdatedEventArgs e) { if (_isInitialized) { //_location = new Vector2d(e.Location.x + 0.0005, e.Location.y + 0.0005); _location = new Vector2d(38.9, -122.40364); //BallUtilities.GetRandomPositionFrom((float)e.Location.x, (float)e.Location.y, 50f); /*for (int i = 0; i < 7; i++){ * _targetPosition = Conversions.GeoToWorldPosition(_locations[i], * _map.CenterMercator, * _map.WorldRelativeScale).ToVector3xz(); * _targetPosition.y = 4; * _balls[i].transform.position = _targetPosition; * } * * GameObject.Find("Ball2").transform.position = _targetPosition;*/ //Vector2d mLocation = new Vector2d(37.7,-122.40364); //_isFirst = false; //for (int i = 0; i < 7; i++){ //Vector2d mLocation = BallUtilities.GetRandomPositionFrom((float)e.Location.x, (float)e.Location.y, 50f); // _targetPositions[i] = Conversions.GeoToWorldPosition(mLocation, //_map.CenterMercator, //_map.WorldRelativeScale).ToVector3xz(); //_balls[i].transform.position = _targetPositions[i]; //} //if (_location == null) //{ //_location = BallUtilities.GetRandomPositionFrom((float)e.Location.x, (float)e.Location.y, 0.005f); //_location = new Vector2d(e.Location.x + 0.0005, e.Location.y + 0.0005); //} /*_targetPosition = Conversions.GeoToWorldPosition(_location, * _map.CenterMercator, * _map.WorldRelativeScale).ToVector3xz();*/ //GameObject.Find("Ball2").transform.position = _targetPosition; //transform.position = _targetPosition; } }
void OnLocationUpdate(object sender, LocationUpdatedEventArgs e) { double latitude = e.Location.Coordinate.Latitude; double longitude = e.Location.Coordinate.Longitude; string title = "Your current location"; string description = latitude.To4Decimals() + ", " + longitude.To4Decimals(); MapPos location = MapView.Options.BaseProjection.FromWgs84(new MapPos(longitude, latitude)); if (IsMarkerSet) { markerLabel.Description = description; positionMarker.Geometry = new PointGeometry(location); return; } // Load default market style MarkerStyleBuilder markerStyleBuilder = new MarkerStyleBuilder(); // Add the label to the Marker positionMarker = new Marker(location, markerStyleBuilder.BuildStyle()); // Define label what is shown when you click on marker, with default style var builder = new BalloonPopupStyleBuilder(); markerLabel = new BalloonPopup(positionMarker, builder.BuildStyle(), title, description); // Add the marker and label to the layer markerSource.Add(positionMarker); markerSource.Add(markerLabel); // Center the map in the current location MapView.FocusPos = location; // Zoom in the map in the current location MapView.Zoom = 19f; }
void OnLocationUpdate(object sender, LocationUpdatedEventArgs e) { double latitude = e.Location.Coordinate.Latitude; double longitude = e.Location.Coordinate.Longitude; string title = "Your current location"; string description = latitude.To4Decimals() + ", " + longitude.To4Decimals(); MapPos location = MapView.Options.BaseProjection.FromWgs84(new MapPos(longitude, latitude)); if (IsMarkerSet) { markerLabel.Description = description; positionMarker.Geometry = new PointGeometry(location); return; } // Load default market style MarkerStyleBuilder markerStyleBuilder = new MarkerStyleBuilder(); // Add the label to the Marker positionMarker = new Marker(location, markerStyleBuilder.BuildStyle()); // Define label what is shown when you click on marker, with default style var builder = new BalloonPopupStyleBuilder(); markerLabel = new BalloonPopup(positionMarker, builder.BuildStyle(), title, description); // Add the marker and label to the layer markerSource.Add(positionMarker); markerSource.Add(markerLabel); // Center the map in the current location MapView.FocusPos = location; // Zoom in the map in the current location MapView.Zoom = 19f; }
void LocationUpdated(object sender,LocationUpdatedEventArgs e){ var core = (sender as LocationManager).WoodCore; var args=(sender as LocationManager).ServiceArgs; var location = e.Location; core.InvokeCallback(args.CallbackName, new { lng =location.Coordinate.Longitude, lat = location.Coordinate.Latitude }); }