INNER CODE UNIT · JavaScript

numChunk

bramus/react-native-maps-directions · src/MapViewDirections.js:117

				const numChunk = Math.floor(index / WAYPOINT_LIMIT); 
				accumulator[numChunk] = [].concat((accumulator[numChunk] || []), waypoint); 
				return accumulator;
			}, []);

			// Create routes for each chunk, using:
			// - Endpoints of previous chunks as startpoints for the route (except for the first chunk, which uses initialOrigin)
			// - Startpoints of next chunks as endpoints for the route (except for the last chunk, which uses initialDestination)
			for (let i = 0; i < chunckedWaypoints.length; i++) {
				routes.push({
					waypoints: chunckedWaypoints[i],
					origin: (i === 0) ? initialOrigin : chunckedWaypoints[i-1][chunckedWaypoints[i-1].length - 1],
					destination: (i === chunckedWaypoints.length - 1) ? initialDestination : chunckedWaypoints[i+1][0],
				});
			}
		}
		
		// No splitting of the waypoints is requested/needed.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…