Exemplo n.º 1
0
        internal void GoToCurrentPositionOnZoom()
        {
            renderOffset             = MapPoint.Empty;
            centerTileXYLocationLast = MapPoint.Empty;
            dragPoint = MapPoint.Empty;

            if (MouseWheelZooming)
            {
                if (MouseWheelZoomType != MouseWheelZoomType.MousePositionWithoutCenter)
                {
                    MapPoint pt = new MapPoint(-(CurrentPositionGPixel.X - Width / 2), -(CurrentPositionGPixel.Y - Height / 2));
                    renderOffset.X = pt.X - dragPoint.X;
                    renderOffset.Y = pt.Y - dragPoint.Y;
                }
                else
                {
                    renderOffset.X = -CurrentPositionGPixel.X - dragPoint.X;
                    renderOffset.Y = -CurrentPositionGPixel.Y - dragPoint.Y;
                    renderOffset.Offset(mouseLastZoom);
                }
            }
            else
            {
                mouseLastZoom = MapPoint.Empty;

                MapPoint pt = new MapPoint(-(CurrentPositionGPixel.X - Width / 2), -(CurrentPositionGPixel.Y - Height / 2));
                renderOffset.X = pt.X - dragPoint.X;
                renderOffset.Y = pt.Y - dragPoint.Y;
            }

            UpdateCenterTileXYLocation();
        }
Exemplo n.º 2
0
        public MapPoint FromLatLngToLocal(PointLatLng latlng)
        {
            MapPoint pLocal = Projection.FromLatLngToPixel(latlng, Zoom);

            pLocal.Offset(renderOffset);
            return(pLocal);
        }
Exemplo n.º 3
0
        public void DragOffset(MapPoint offset)
        {
            renderOffset.Offset(offset);

            UpdateCenterTileXYLocation();

            if (centerTileXYLocation != centerTileXYLocationLast)
            {
                centerTileXYLocationLast = centerTileXYLocation;
                UpdateBounds();
            }

            {
                LastLocationInBounds = CurrentPosition;
                CurrentPosition      = FromLocalToLatLng((int)Width / 2, (int)Height / 2);
            }

            if (OnMapDrag != null)
            {
                OnMapDrag();
            }
        }