def split_to_sections(points_list, nodes_info) -> list: """ :param points_list: list of points of type Point (from Section) :return list of sections, such that each geographical parameter is valid to all of it """ sections = [] start = points_list[0] info = fetch_point_info(start, nodes_info) sec = create_section_from_info(info) sections.append(sec) for point in points_list[1:]: info = fetch_point_info(point, nodes_info) if info: next_sec = create_section_from_info(info) if Section.check_if_dff(sec, next_sec): sections.append(next_sec) sec = next_sec start_sec = sections[0] for section in sections[1:]: end_sec = section start_sec.end_point = end_sec.start_point start_sec.length = Point.calc_distance(start_sec.start_point, start_sec.end_point) start_sec = end_sec return sections