VEMap.SetFailedShapeRequest Method

You are not viewing the latest version of the AJAX control. Bing Maps AJAX V7 is the recommended JavaScript control for Bing Maps. If you need this documentation, it is available in as a CHM or PDF download.

Specifies what the map control does when a request to the server to get the accurate position of a shape when the map style is changed to birdseye fails.


VEMap.SetFailedShapeRequest(policy);

Parameters

Parameter Description

policy

A VEFailedShapeRequest Enumeration value that defines the policy.

By default, shapes are not subject to increased accuracy representation when the map style is set to birdseye (the default accuracy is VEShapeAccuracy.None). Use the VEMap.SetShapesAccuracy Method to improve the accuracy of shapes when setting the map style to birdseye. By default, up to 50 shapes are converted at at time. To change this value, use the VEMap.SetShapesAccuracyRequestLimit Method.

This method must be called before the shapes are added to the map, otherwise the default policy (VEFailedShapeRequest.DrawInaccurately) is followed.

The examples uses the following custom images.

Bb877846.308601ce-86f6-46fc-8bfb-2d5d97688b15(en-us,MSDN.10).gif Bb877846.8c503060-0bbd-4e3e-bd49-38739442678b(en-us,MSDN.10).gif

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
   <head>
      <title></title>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.3"></script>

      <script type="text/javascript">
         var map = null;

         function GetMap()
         {
            map = new VEMap('myMap');
            map.onLoadMap = DoAfterMapLoaded;
            map.LoadMap(new VELatLong(47.6215, -122.3472), 17, VEMapStyle.Road);
         }

         function DoAfterMapLoaded()
         {
            // Show pushpins accurately,
            // User can disable by deselecting check button before selecting birdseye
            map.SetShapesAccuracy(VEShapeAccuracy.Pushpin);

            // Don't try to show extra shapes
            map.SetFailedShapeRequest(VEFailedShapeRequest.DoNotDraw);

            // Convert a max of 10 points accurately at a time
            map.SetShapesAccuracyRequestLimit(10);

            var FifthAndHarrison  = new VELatLong(47.62205, -122.34753);
            var HarrisonAndTaylor = new VELatLong(47.62205, -122.34627);
            var TaylorAndBroad    = new VELatLong(47.6217, -122.34627);
            var FifthAndBroad     = new VELatLong(47.6207, -122.34753);

            var pushpin1 = new VEShape(VEShapeType.Pushpin, FifthAndHarrison);
            pushpin1.SetCustomIcon("images/RedX16.gif");
            var pushpin2 = new VEShape(VEShapeType.Pushpin, HarrisonAndTaylor);
            pushpin2.SetCustomIcon("images/RedX16.gif");
            var pushpin3 = new VEShape(VEShapeType.Pushpin, TaylorAndBroad);
            pushpin3.SetCustomIcon("images/RedX16.gif");
            var pushpin4 = new VEShape(VEShapeType.Pushpin, FifthAndBroad);
            pushpin4.SetCustomIcon("images/RedX16.gif");

            map.AddShape(pushpin1);
            map.AddShape(pushpin2);
            map.AddShape(pushpin3);
            map.AddShape(pushpin4);
         }

         function CheckBoxClicked(cb)
         {
            var shapeAccuracy = VEShapeAccuracy.None;

            if (cb.checked)
            {
               shapeAccuracy = VEShapeAccuracy.Pushpin;
            }

            map.SetShapesAccuracy(shapeAccuracy);
         }
      </script>
   </head>
   <body onload="GetMap();">
      <div id='myMap' style="position:relative; width:600px; height:400px;"></div>

      <input id='CB1' type=checkbox checked onclick="CheckBoxClicked(this)" />
      Enable Birdseye Accuracy
      <br/>
     (you don't really notice it until you look west in birdseye by clicking the
     <img border="0" src="images/CounterClockwise.gif" width="22" height="21">
     button once).
   </body>
</html>

Show: