public void CenterAt(String latLong, double zoom) { // Center textBlockLatLong.Text = latLong; var splitted = latLong.Split(' '); var latdec = LatLongUtil.ConvertDegreeAngleToDouble(splitted[0]); var londec = LatLongUtil.ConvertDegreeAngleToDouble(splitted[1]); LatLongUtil.TranslateTransform.X = -londec; LatLongUtil.TranslateTransform.Y = LatLongUtil.LatitudeToY(latdec); // Set zoom LatLongUtil.ScaleTransform.ScaleX = zoom; LatLongUtil.ScaleTransform.ScaleY = zoom; textBlockZoom.Text = zoom.ToString("###0.00"); // Now centered at upper-left corner, center at the windows center var dragVector = new Point(ActualWidth / 2 / LatLongUtil.ScaleTransform.ScaleX, ActualHeight / 2 / LatLongUtil.ScaleTransform.ScaleY); LatLongUtil.TranslateTransform.X += dragVector.X; LatLongUtil.TranslateTransform.Y += dragVector.Y; DrawLines(); }
public void TestLatitudeToY() { var y = LatLongUtil.LatitudeToY(55.6); }
public void TestYToLatIsInverseOfLatToY() { Assert.AreEqual(20.0, LatLongUtil.LatitudeToY(LatLongUtil.YToLatitude(20)), 0.0001); }