All Downloads are FREE. Search and download functionalities are using the official Maven repository.

assets.js.routeManipulation.js Maven / Gradle / Ivy

var L = require('leaflet');

module.exports.getIntermediatePointIndex = function(routeSegments, clickedLocation) {
    // for each point of the route determine its distance to the clicked location and the index
    // of the waypoint that comes next if we keep following the route
    var nextWayPointIndex = 0;
    var wayPoints = routeSegments[0].wayPoints;
    var distancesAndNextWayPointIndices = [];
    for(var i=0; i 0 && result < wayPoints.length) ? result : 1; //just for safety
    return result;
};




© 2015 - 2024 Weber Informatics LLC | Privacy Policy