示例#1
0
        public void TestConvertDegreeAngleToDouble()
        {
            var coord1 = LatLongUtil.ConvertDegreeAngleToDouble("N055.37.40.078");

            Assert.AreEqual(55, (int)coord1);

            var coord2 = LatLongUtil.ConvertDegreeAngleToDouble("N055.40.40.078");

            Assert.AreEqual(55, (int)coord2);
            Assert.IsTrue(coord1 < coord2);
        }
        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();
        }