With the AJAX Control, we can add pins, lines, and polygons to the map. We can even add complex shapes, such as donut structures, if we load the Microsoft.Maps.AdvancedShapes
module. However, the library does not have built-in tools that allow the user to draw shapes manually, so let's create one.
We will build the code we wrote in the previous chapter. This means that we have an app.js
file, where we instantiate the map, and load the
LearningTheme
module, which customizes the look and the behavior of the map.
We will create our tool as a module, and name it ShapeDrawing
. Just as we did in Chapter 1, Introduction to BING Maps AJAX Control Version 7, let's create a folder named shapeDrawing
, and a JavaScript file inside it with the same name. The module skeleton is simple, as shown in the following code:
(function() { var lbm = window.lbm || {}; lbm.ShapeDrawing = function(map) { this._map = map; }; Microsoft.Maps.moduleLoaded...