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planXML = `
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
diff --git a/VVSU/js/point_refs.js b/VVSU/js/point_refs.js
index e10b6f8..f114e18 100644
--- a/VVSU/js/point_refs.js
+++ b/VVSU/js/point_refs.js
@@ -18,6 +18,7 @@ function getFloorArray() {
let floorSet = new Set()
const len = plan.points.length;
+ pointsHTMLByFloor['fav'] = '';
for (let i = 0; i < len; i++) {
//console.log(plan.points[i].floor)
let point = plan.points[i];
@@ -32,6 +33,10 @@ function getFloorArray() {
pointsHTMLByFloor[floorNumber] += str;
}
}
+
+ if (point.fav) {
+ pointsHTMLByFloor['fav'] += pointNameToHTML(point.name, point.id);
+ }
}
return Array.from(floorSet).sort();
@@ -42,8 +47,13 @@ function createFloorMenuItems(floor_array)
referencesFloorMenu.innerHTML = '';
const len = floor_array.length;
+ let e = document.createElement('li');
+ e.setAttribute('data-floor', 'fav');
+ // e.innerHTML = '☆';
+ e.innerHTML = '✭';
+ referencesFloorMenu.appendChild(e);
for(let i=0; i");
let route_str = route.map((val, idx) => {
- return getRouteStepComponentString(val, getRandomInt(2) === 1 ? 'Пример текста' : '');
+ return getRouteStepComponentString(val.route, val.detailed_route);
}).join(' ');
outputContainer.innerHTML = route_str;
diff --git a/find_route.js b/find_route.js
index 370c730..5a6861f 100644
--- a/find_route.js
+++ b/find_route.js
@@ -46,6 +46,7 @@ function get_edge (point, adj_point_index)
function get_route_text (route)
{
let route_text = [];
+ // let detailed_route_text = [];
let i = 0;
let j = 0;
let edge = get_edge(plan.points[route[0]], route[1]);
@@ -70,11 +71,15 @@ function get_route_text (route)
}
if (path_index == -1) {
floorText = " с " + plan.points[route[i]].floor + " этажа до " + plan.points[route[j]].floor + " этажа.";
- route_text.push("Пройти по лестнице" + floorText);
+ route_text.push({route: "Пройти по лестнице" + floorText,
+ detailed_route: ""});
+ // detailed_route_text.push("");
} else if (path_index == -2) {
- route_text.push("Проехать на лифте.");
+ route_text.push({route: "Проехать на лифте.",
+ detailed_route: ""});
} else {
let text = "Пройти " + plan.points[route[i]].name + " - " + plan.points[route[j]].name;
+ let detailed_text = "";
if (j > i + 1) {
let hidden = true;
for (let k = i + 1; k < j; k++) {
@@ -84,21 +89,21 @@ function get_route_text (route)
}
}
if (!hidden) {
- text += " мимо: ";
+ detailed_text += " мимо: ";
}
let flag = false;
for (let k = i + 1; k < j; k++) {
if (!plan.points[route[k]].hidden) {
if (flag) {
- text += ", ";
+ detailed_text += ", ";
}
flag = true;
- text += plan.points[route[k]].name;
+ detailed_text += plan.points[route[k]].name;
}
}
}
text += ".";
- route_text.push(text);
+ route_text.push({route: text, detailed_route: detailed_text});
}
if (new_path_index >= 0 && path_index >= 0) {
@@ -113,11 +118,14 @@ function get_route_text (route)
let d = (dir1 - dir2 + 4) % 4;
if (d > motionDirForStr("up")) {
if (motionDir[d] == "left") {
- route_text.push("Поверните налево.");
+ route_text.push({route: "Поверните налево.",
+ detailed_route: "аккуратно"});
} else if (motionDir[d] == "down") {
- route_text.push("Поверните назад.");
+ route_text.push({route: "Поверните назад.",
+ detailed_route: "внимательно"});
} else if (motionDir[d] == "right") {
- route_text.push("Поверните направо.");
+ route_text.push({route: "Поверните направо.",
+ detailed_route: "осторожно"});
}
}
}
@@ -129,7 +137,7 @@ function get_route_text (route)
break;
}
}
- return route_text;
+ return route_text; // { route: route_text, detailed_route: detailed_route_text };
}
function findRoute (point_from, point_to)
@@ -159,4 +167,4 @@ function findRoute (point_from, point_to)
let route_text = get_route_text(route);
//route_strs.push.apply(route_strs, route_text); // добавить route_text к route_strs
return route_text;
-}
\ No newline at end of file
+}
diff --git a/read_plan.js b/read_plan.js
index f23e4d6..94cb6a6 100644
--- a/read_plan.js
+++ b/read_plan.js
@@ -86,6 +86,8 @@ function process_xml_node (xml_node, path_index, floor_num)
location: ("location" in xml_node.attributes ? xml_node.attributes["location"].nodeValue : ""),
hidden: (xml_node.attributes["show_name"] != "1"),
edges: [],
+ to: ("to" in xml_node.attributes ? xml_node.attributes["to"].nodeValue : ""),
+ fav: ("fav" in xml_node.attributes)
};
// добавляем новый пункт
let point_index;
@@ -202,6 +204,9 @@ function read_plan ()
for (floor_child of plan_child.childNodes) {
if (floor_child.tagName == "Path") {
// обрабатываем путь перемещения
+ if (!("dir" in floor_child.attributes)) {
+ alert("Поле dir отсутствует в корневом теге ");
+ }
let dir_str = floor_child.attributes["dir"].nodeValue;
let dir = motionDirForStr(dir_str);
let path = {
@@ -215,6 +220,9 @@ function read_plan ()
// добавляем начальный пункт к пути
// тут важно указать этаж, поскольку пункт может оказаться
// лестницей или лифтом, для которых идентификатор один и тот же на разных этажах
+ if (!("start" in floor_child.attributes)) {
+ alert("Поле start отсутствует в корневом теге ");
+ }
let point_index = get_point_by_id(floor_child.attributes["start"].nodeValue, floor_num);
add_point_to_path(point_index, path_index);
// читаем путь