function drawWarehousePath()

in use-cases/order-picking/src/main/resources/META-INF/resources/warehouse-api.js [152:182]


function drawWarehousePath(warehouseLocations, trolleyIndex, trolleyCount) {
    const ctx = getWarehouseCanvasContext();
    const startLocation = warehouseLocations[0];
    const startShelving = SHELVINGS_MAP.get(startLocation.shelvingId);
    const startPoint = location2Point(startShelving, startLocation.side, startLocation.row, trolleyIndex, trolleyCount);
    let lastPoint = startPoint;
    let lastShelving = startShelving;
    let lastSide = startLocation.side;
    let lastRow = startLocation.row;

    ctx.beginPath();
    ctx.moveTo(startPoint.x, startPoint.y);
    ctx.arc(startPoint.x, startPoint.y, 5, 0, 2 * Math.PI);

    for (let i = 1; i < warehouseLocations.length; i++) {
        const location = warehouseLocations[i];
        const shelving = SHELVINGS_MAP.get(location.shelvingId);
        const side = location.side;
        const row = location.row;
        const point = location2Point(shelving, location.side, location.row, trolleyIndex, trolleyCount);
        drawWarehousePathBetweenShelves(ctx, trolleyIndex, trolleyCount, lastShelving, lastSide, lastRow, lastPoint,
                shelving, side, row, point);
        ctx.arc(point.x, point.y, 5, 0, 2 * Math.PI);
        lastPoint = point;
        lastShelving = shelving;
        lastSide = side;
        lastRow = row;
    }
    ctx.stroke();
    ctx.closePath();
}