Export (0) Print
Expand All

EntityCollectionOptions Object

Bing

Contains options for an entity collection.

Properties

Name Type Description

bubble

boolean

A boolean indicating whether to set the options of all entities when an option of an entity within the collection is set. The default value is true. For example, in an entity collection composed of multiple polygons, if this property is set to true setting one polygon’s fill color to red changes the fill color of all of the other polygons in the entity collection to red.

Gg427614.note(en-us,MSDN.10).gifNote:
This property is only available when the Microsoft.Maps.AdvancedShapes module is loaded.

visible

boolean

A boolean indicating whether the entity collection is visible on the map.

zIndex

number

The z-index of the entity collection with respect to other items on the map.

Example

<!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=7.0"></script>

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

         function GetMap()
         {
            // Initialize the map
            map = new Microsoft.Maps.Map(document.getElementById("mapDiv"),{credentials:"Bing Maps Key"}); 

            // Add handler for the map click event - add a pin to the click location.
            Microsoft.Maps.Events.addHandler(map, 'click', addPin);
            

         }

         function addPin(e) {
              if (e.targetType == "map") {

                  // Return the location where the map was clicked and create the pin.
                  var point = new Microsoft.Maps.Point(e.getX(), e.getY());
                  var loc = e.target.tryPixelToLocation(point);
                  var pin = new Microsoft.Maps.Pushpin(loc);

                  // Add the pushpin
                  map.entities.push(pin);
                  

              }
         }

         function hideAllPins(){
              // Hide all the entities on the map
              map.entities.setOptions({visible:false});
         }


         function showAllPins(){
              // Show all the entities on the map
              map.entities.setOptions({visible:true});
         }


      </script>
   </head>
   <body onload="GetMap();">
      <div id='mapDiv' style="position:relative; width:400px; height:400px;"></div>       
      <input type="button" value="Hide all pins" onclick="hideAllPins();"/>
      <input type="button" value="Show all pins" onclick="showAllPins();"/>
   </body>
</html>
Show:
© 2014 Microsoft