VEMap.EnableShapeDisplayThreshold 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 whether shapes are drawn below a threshold zoom level.

VEMap.EnableShapeDisplayThreshold(enable);

Parameters

Parameter Description

enable

A Boolean value specifying whether to draw shapes below a threshold zoom level. By default shapes are not drawn below a threshold zoom level.

Remarks

By default, the map control performs the following polyline and polygon shape performance optimizations at low zoom levels.

  • If a polyline or polygon is very small, it is not drawn.

  • If the latitude and longitude of two vertices of a polyline or polygon are too near each other, they are not drawn.

If this method is called with enable set to false, these optimizations are disabled and the map control does the following.

  • The map control attempts to draw the polyline or polygon, regardless of its size.

  • The map control attempts to draw all of the vertices of the polyline or polygon, regardless of how close they are to another vertex.

Example

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://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="https://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.3"></script>

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

         var Green = new VEColor(0, 255, 0, 0.5);

         var topLeft  = new VELatLong(47.8242, -122.3877);
         var topRight = new VELatLong(47.8242,  -122.0883);
         var botRight = new VELatLong(47.4689,  -122.0883);
         var botLeft  = new VELatLong(47.4689, -122.3877);

         function GetMap()
         {
            map = new VEMap('myMap');
            map.LoadMap(new VELatLong(47.6987, -122.2503), 9);

            MyShape = new VEShape(VEShapeType.Polygon, new Array(topLeft, topRight, botRight, botLeft));
            MyShape.HideIcon();
            MyShape.SetFillColor(Green);

            map.AddShape(MyShape);
         }

         function SetShapeThreshold(enable)
         {
            if (enable.checked)
            {
               map.EnableShapeDisplayThreshold(true);
            }
            else
            {
               map.EnableShapeDisplayThreshold(false);
            }
         }
      </script>
   </head>
   <body onload="GetMap();">
      <div id='myMap' style="position:relative; width:600px; height:400px;"></div>
      <p>&nbsp;</p>

      <input id="enablest" type=checkbox checked onclick="SetShapeThreshold(this)" />
         Enable Shape Threshold
         <br/>
         (click zoom out 4 times to see it disappear by default)
   </body>
</html>

See Also

Reference

VEShape.SetMinZoomLevel Method