Export (0) Print
Expand All

Point Class

Bing

Represents a point on the map.

Constructor

Name Definition Description

Point

Point(x:number, y:number)

Initializes a new instance of the Point class.

Properties

Name Type Description

x

number

The x value of the coordinate.

y

number

The y-value of the coordinate.

Static Methods

Name Definition Return Value Description

areEqual

areEqual(point1: Point , point2: Point )

boolean

Determines if the specified points are equal.

clone

clone( Point )

Point

Returns a copy of the Point object.

Methods

Name Definition Return Value Description

clone

clone()

Point

Returns a copy of the Point object.

toString

toString()

string

Converts the Point object into a string.

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("myMap"),
                         {credentials:"Bing Maps Key "}); 

            // Add handler for the map click event.
            Microsoft.Maps.Events.addHandler(map, 'click', displayEventInfo);


         }

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

                  var point = new Microsoft.Maps.Point(e.getX(), e.getY());
                  var loc = e.target.tryPixelToLocation(point);

                  if (loc!=null)
                  {
                     alert("The location " + loc.latitude + ", " + loc.longitude + " was clicked.");
                  }
 
              }
          }

      </script>
   </head>
   <body onload="GetMap();">
      <div id='myMap' style="position:relative; width:400px; height:400px;"></div><br>
      <b>Click the map to display the coordinate values at that point.</b><br>
   </body>
</html>
Show:
© 2015 Microsoft