"undefined" variable values

180 views
Skip to first unread message

Hristi

unread,
Mar 26, 2013, 3:11:51 PM3/26/13
to google-maps...@googlegroups.com
Hi,

I have downloaded the two files BpTspSolver.js and tsp.js and also added an .html file (copied from some of the previous posts) to test it.
When I debug the javascript (using firebug) all the variables have value "undefined".
ex.
    var order = tsp.getOrder();
    var durations = tsp.getDurations();

I am using the following code:

    function initialize() {
    var myOptions = {
      zoom: 12,
      center: new google.maps.LatLng(46.0500, 14.5000 ),
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    myMap = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

    directionsPanel = document.getElementById("my_textual_div");

    tsp = new BpTspSolver(myMap, directionsPanel);

    tsp.setAvoidHighways(true);
    tsp.setTravelMode(google.maps.DirectionsTravelMode.WALKING);

    tsp.addWaypoint(new google.maps.LatLng(46.0500, 14.5000 ),addWaypointCallback);
    tsp.addWaypoint(new google.maps.LatLng(46.0520, 14.5090 ), addWaypointCallback);
    tsp.addWaypoint(new google.maps.LatLng(46.0590, 14.5050 ), addWaypointCallback);
   
    tsp.solveRoundTrip(onSolveCallback);

    var order = tsp.getOrder();
    var durations = tsp.getDurations();

    }
    function addWaypointCallback() {
    }
    function onSolveCallback() {
   
    }

Thanks in advance,
Hristijan

Reply all
Reply to author
Forward
0 new messages