Now, let's create a line that will connect the pushpins, by adding the following code to our _start
function:
this._line = new Microsoft.Maps.Polyline([new Microsoft.Maps.Location(0, 0)], { strokeColor: new Microsoft.Maps.Color(200, 240, 76, 64), strokeThickness: 2 }); this._counter = 0;
The Polyline
class' constructor accepts two arguments: an array of locations and a PolylineOptions
object. We initialize our polyline with an array containing a dummy location, and a couple of options (the full reference of PolylineOptions
can be found at http://msdn.microsoft.com/en-us/library/gg427595.aspx):
We also maintain a count of the user clicks, which also stores the number of locations that make up the polyline. We make sure to reset the _counter
instance variable when the user starts drawing, so that the clicks are not...