private void PrepareDisplayPositions() { foreach (GeoPlacemark place in visiblePlacemarks) { double mathAngle = 90 - Math.Abs(place.Angle); double x = (place.Distance * Math.Cos(LatLongMath.ToRad(mathAngle))); double y = (place.Distance * Math.Sin(LatLongMath.ToRad(mathAngle))); x = (x * (displayWidth / maxDistance)); y = (place.Distance * (displayHeight / maxDistance)); if (place.Angle < 0) { x = -x; } place.DisplayX = (displayWidth / 2) + x; place.DisplayY = (displayHeight - y); } }
public GeoPlacemark GetNextPoint(double compassHeading) { if (pathWay.Count > 0) { GeoPlacemark place = pathWay.ElementAt(0); double newSpan = 80; left = ((compassHeading - newSpan) + 360) % 360; right = ((compassHeading + newSpan) + 360) % 360; place.Angle = FindAngularDisplacement(place, compassHeading); if (place.Angle != -180) { double mathAngle = 90 - Math.Abs(place.Angle); double x = (place.Distance * Math.Cos(LatLongMath.ToRad(mathAngle))); double y = (place.Distance * Math.Sin(LatLongMath.ToRad(mathAngle))); x = (x * ((displayWidth / 3) / place.Distance)); y = (place.Distance * (displayHeight / (maxDistance / 3))); if (place.Angle < 0) { x = -x; } place.DisplayX = (displayWidth / 2) + x; //place.DisplayY = (displayHeight - y); place.DisplayY = (displayHeight) - y; } return(place); } return(null); }