Skip to content

Commit

Permalink
Merge branch 'main' into format-2
Browse files Browse the repository at this point in the history
  • Loading branch information
lapkin25 authored Dec 2, 2023
2 parents 46617b8 + 330997a commit f6e50ef
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 25 deletions.
16 changes: 9 additions & 7 deletions VVSU/js/Plan_VVSU.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
let planXML = `
<Plan name="VVSU">
<Exit id="2" floor="3" name="Вход 2" />
<Exit id="1" floor="1" name="Вход 1" />
<Plan object="VVSU">
<Exit id="2" name="Вход 2" floor="3" show_name="1" />
<Floor num="3">
<Path start="2" walls="left_right" dir="right">
<Joint to="поворота на Андеграунд" />
Expand Down Expand Up @@ -140,12 +139,13 @@ let planXML = `
</Path>
</Path>
</Path>
</Path>
</Path>
</Path>
</Path>
</Floor>
<Exit id="1" name="Вход 1" floor="1" show_name="1" />
<Floor num="1">
<Stairs id="stairs5" name="Лестница" />
<Path start="1" walls="right" dir="up">
Expand Down Expand Up @@ -192,7 +192,6 @@ let planXML = `
</Path>
</Floor>
<Floor num="2">
<Stairs id="stairs5" name="Лестница" />
<Path start="stairs5" walls="left_right" dir="up">
Expand Down Expand Up @@ -249,6 +248,9 @@ let planXML = `
</Path>
</Floor>
<Floor num="4">
<Stairs id="stairs5" name="Лестница" />
<Path start="stairs5" walls="left" dir="up">
Expand Down
4 changes: 0 additions & 4 deletions find_route.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,6 @@ function findRoute (point_from, point_to)
}

let route = get_route(plan.point_by_id.get(point_from), plan.point_by_id.get(point_to));
if (route.length == 0) {
throw new Error(`Пункт ${point_to} недостижим из пункта ${point_from}`);
}

let route_text = get_route_text(route);
//route_strs.push.apply(route_strs, route_text); // добавить route_text к route_strs
return route_text;
Expand Down
21 changes: 7 additions & 14 deletions read_plan.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function get_point_by_id (point_id, floor)
point_index = plan.point_by_id.get(elevator_point_id);
else
point_index = plan.point_by_id.get(point_id);
if (point_index == undefined) { alert("Ошибка: пункт с id " + point_id + " на этаже " + floor + " не найден!"); }
if (point_index == undefined) { alert("Ошибка: точка с id " + point_id + " на этаже " + floor + " не найдена!"); }
return point_index;
}

Expand Down Expand Up @@ -83,8 +83,8 @@ function process_xml_node (xml_node, path_index, floor_num)
id: ("id" in xml_node.attributes ? xml_node.attributes["id"].nodeValue : ""),
name: ("name" in xml_node.attributes ? xml_node.attributes["name"].nodeValue : ""),
type: "",
wall: ("wall" in xml_node.attributes ? xml_node.attributes["wall"].nodeValue : ""),
hidden: false, //(xml_node.attributes["show_name"] != "1"),
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)
Expand Down Expand Up @@ -131,15 +131,9 @@ function process_xml_node (xml_node, path_index, floor_num)
else if (node_tag == "Wall") {
point_index = add_point(point);
}
else if (node_tag == "Door") {
else if (node_tag = "Door") {
point_index = add_point(point);
}
else if (node_tag == "Joint") {
point_index = add_point(point);
}
else {
alert(node_tag);
}
}
// добавляем пункт к пути
if (path_index != -1)
Expand Down Expand Up @@ -167,13 +161,12 @@ function read_path (xml_node, path_index, floor_num)
for (node_child of xml_node.childNodes) {
if (node_child.tagName == "Path") {
// обрабатываем путь перемещения
// let point_index = get_point_by_id(node_child.attributes["start"].nodeValue, floor_num);
let point_index = plan.paths[path_index].path_points[plan.paths[path_index].path_points.length - 1];
let point_index = get_point_by_id(node_child.attributes["start"].nodeValue, floor_num);
let rotate_str = node_child.attributes["rotate"].nodeValue;
let parent_path_dir = plan.paths[path_index].dir;
let dir = rotate_dir(parent_path_dir, rotate_str);
let path = {
walls: ("walls" in node_child.attributes ? node_child.attributes["walls"].nodeValue : "no"),
type: node_child.attributes["type"].nodeValue,
dir: dir,
path_points: [point_index],
};
Expand Down Expand Up @@ -217,7 +210,7 @@ function read_plan ()
let dir_str = floor_child.attributes["dir"].nodeValue;
let dir = motionDirForStr(dir_str);
let path = {
walls: ("walls" in floor_child.attributes ? floor_child.attributes["walls"].nodeValue : "no"),
type: floor_child.attributes["type"].nodeValue,
dir: dir,
path_points: [],
};
Expand Down

0 comments on commit f6e50ef

Please sign in to comment.