Beispiel #1
0
        /// <summary>
        /// Changes the Center property according to the specified map translation in viewport coordinates.
        /// </summary>
        public void TranslateMap(Point translation)
        {
            if (transformCenter != null)
            {
                ResetTransformCenter();
                UpdateTransform();
            }

            if (translation.X != 0d || translation.Y != 0d)
            {
                if (Heading != 0d)
                {
                    var cos = Math.Cos(Heading / 180d * Math.PI);
                    var sin = Math.Sin(Heading / 180d * Math.PI);

                    translation = new Point(
                        translation.X * cos + translation.Y * sin,
                        translation.Y * cos - translation.X * sin);
                }

                translation.X = -translation.X;
                translation.Y = -translation.Y;

                Center = MapProjection.TranslateLocation(Center, translation);
            }
        }