diff --git a/loadgpx.js b/loadgpx.js index eaef8fa..a9f5839 100644 --- a/loadgpx.js +++ b/loadgpx.js @@ -131,6 +131,8 @@ GPXParser.prototype.createMarker = function(point) { google.maps.event.addListener(marker, "click", function() { infowindow.open(this.map, marker); }); + + return { marker: marker, infowindow: infowindow }; } GPXParser.prototype.addTrackSegmentToMap = function(trackSegment, colour, @@ -171,14 +173,18 @@ GPXParser.prototype.addTrackSegmentToMap = function(trackSegment, colour, strokeWeight: width, map: this.map }); + return polyline; } GPXParser.prototype.addTrackToMap = function(track, colour, width) { var segments = track.getElementsByTagName("trkseg"); + var result = []; for(var i = 0; i < segments.length; i++) { - var segmentlatlngbounds = this.addTrackSegmentToMap(segments[i], colour, + var polyline = this.addTrackSegmentToMap(segments[i], colour, width); + result.push(polyline); } + return result; } GPXParser.prototype.addRouteToMap = function(route, colour, width) {