|
|
|
@ -81,7 +81,7 @@ class WaypointsData {
|
|
|
|
|
const waypoints = new WaypointsData();
|
|
|
|
|
const markerUrl = './img/map-marker.png';
|
|
|
|
|
// Максимальное число путей для перебора
|
|
|
|
|
const max_ways_count = 200000;
|
|
|
|
|
const max_ways_count = 400000;
|
|
|
|
|
let regionPointsWidget;
|
|
|
|
|
let selectedPointsWidget;
|
|
|
|
|
|
|
|
|
@ -212,35 +212,46 @@ function showTravelPoints(indexes) {
|
|
|
|
|
let calculatedPoints = [];
|
|
|
|
|
let prevPoint = null;
|
|
|
|
|
let id = 0;
|
|
|
|
|
let total_distance = 0;
|
|
|
|
|
for (const idx in points) {
|
|
|
|
|
const point = points[idx];
|
|
|
|
|
if (prevPoint != null) {
|
|
|
|
|
const d = (calculateDistance(point.location[0], point.location[1], prevPoint.location[0], prevPoint.location[1]) / 1000.0).toFixed(2);
|
|
|
|
|
const d = calculateDistance(point.location[0], point.location[1], prevPoint.location[0], prevPoint.location[1]) / 1000.0;
|
|
|
|
|
total_distance += d;
|
|
|
|
|
calculatedPoints.push({
|
|
|
|
|
ID: id,
|
|
|
|
|
Waypoint: d + ' км.'
|
|
|
|
|
Waypoint: d.toFixed(2) + ' км.',
|
|
|
|
|
type: 'distance'
|
|
|
|
|
});
|
|
|
|
|
id++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
calculatedPoints.push({
|
|
|
|
|
ID: id,
|
|
|
|
|
Waypoint: point.text
|
|
|
|
|
Waypoint: point.text,
|
|
|
|
|
type: 'pointName'
|
|
|
|
|
});
|
|
|
|
|
id++;
|
|
|
|
|
|
|
|
|
|
prevPoint = point;
|
|
|
|
|
}
|
|
|
|
|
calculatedPoints.push({
|
|
|
|
|
ID: id,
|
|
|
|
|
Waypoint: "Общая длина маршрута: " + total_distance.toFixed(2) + ' км.',
|
|
|
|
|
type: 'distance'
|
|
|
|
|
});
|
|
|
|
|
$(() => {
|
|
|
|
|
$('#waypointsGrid').dxDataGrid({
|
|
|
|
|
$('#waypointsGrid').dxList({
|
|
|
|
|
dataSource: calculatedPoints,
|
|
|
|
|
showColumnHeaders: false,
|
|
|
|
|
showColumnLines: false,
|
|
|
|
|
showRowLines: true,
|
|
|
|
|
rowAlternationEnabled: true,
|
|
|
|
|
height: 400,
|
|
|
|
|
width: '100%',
|
|
|
|
|
showScrollbar: 'always',
|
|
|
|
|
keyExpr: 'ID',
|
|
|
|
|
columns: ['Waypoint'],
|
|
|
|
|
showBorders: true,
|
|
|
|
|
itemTemplate(data) {
|
|
|
|
|
const result = $('<div>').addClass(data.type).text(data.Waypoint);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|