public void MarkerAnimation(double latitude, double longitude, Action callback) { //gán lại vòng quay double mMoveIndex = 0; double MAX_MOVE_STEP = 40; var startPosition = this.Position; var finalPosition = new Position(latitude, longitude); double elapsed = 0; double t; double v; Device.StartTimer(TimeSpan.FromMilliseconds(100), () => { // Calculate progress using interpolator elapsed = elapsed + 100; t = elapsed / 4000; v = GeoHelper.GetInterpolation(t); var postionnew = GeoHelper.Interpolate(v, new Position(startPosition.Latitude, startPosition.Longitude), new Position(latitude, longitude)); mMoveIndex = mMoveIndex + 1; this.Position = new Position(postionnew.Latitude, postionnew.Longitude); if (mMoveIndex > MAX_MOVE_STEP) { callback(); return(false); } return(true); }); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { string result = string.Empty; if ((value is double)) { result = GeoHelper.LatitudeToDergeeMinSec((double)value); } return(result); }
public void Rotate(double latitude, double longitude, Action callback) { //gán lại vòng quay var mRotateIndex = 0; // * tính góc quay giữa 2 điểm location var angle = GeoHelper.ComputeHeading(this.Position.Latitude, this.Position.Longitude, latitude, longitude); if (angle == 0) { callback(); return; } //tính lại độ lệch góc var deltaAngle = GeoHelper.GetRotaion(this.Rotation, angle); var startRotaion = this.Rotation; Device.StartTimer(TimeSpan.FromMilliseconds(50), () => { //góc quay tiếp theo var fractionAngle = GeoHelper.ComputeRotation( mRotateIndex / 10, startRotaion, deltaAngle); mRotateIndex = mRotateIndex + 1; this.Rotation = (float)fractionAngle; if (mRotateIndex > 10) { callback(); return(false); } return(true); }); }