0

I would like to calculate the amount of panning and zooming (either in terms of latitude/longitude or in pixels) a user does while working with bing map (I am using windows phone 7 platform). any suggestion to solve that problem would be highly appreciated.

MKS
  • 736
  • 2
  • 14
  • 33

1 Answers1

0

Found the solution:

Map map = new Map();
map.MapPan += new EventHandler<MapDragEventArgs>(map_MapPan);
map.MapZoom += new EventHandler<MapZoomEventArgs>(map_MapZoom);

   void map_MapZoom(object sender, MapZoomEventArgs e)
    {
        if (e.ZoomDelta >= 0)
            totalZoomInDelta += Math.Round(e.ZoomDelta, 2);
        else
            totalZoomOutDelta += Math.Abs(Math.Round(e.ZoomDelta, 2));
    }

    void map_MapPan(object sender, MapDragEventArgs e)
    {

       totalAbsDragDeltaX += Math.Abs(e.DragDelta.X);
       totalAbsDragDeltaY += Math.Abs(e.DragDelta.Y);

       totalDragDeltaX += e.DragDelta.X;
       totalDragDeltaY += e.DragDelta.Y;

       totalDragDelta += Math.Sqrt(e.DragDelta.X * e.DragDelta.X + e.DragDelta.Y * e.DragDelta.Y);
    }
MKS
  • 736
  • 2
  • 14
  • 33