fixed refiner
All checks were successful
Build and push docker image / Build (pull_request) Successful in 2m36s
Build and release APK / Build APK (pull_request) Successful in 5m31s
Build web / Build Web (pull_request) Successful in 1m15s

This commit is contained in:
Helldragon67 2024-06-23 12:08:51 +02:00
parent 34922a2645
commit fd378d6289
5 changed files with 649 additions and 12648 deletions

View File

@ -120,18 +120,24 @@ def remove_duplicates(L: List[Landmark]) -> List[Landmark] :
Returns:
List[Landmark]: A list of unique Landmark objects based on their names.
"""
L_clean = []
names = []
coords = []
for landmark in L :
if landmark.name in names and landmark.location in coords:
continue
continue
approx_coords = tuple((round(landmark.location[0], 4), round(landmark.location[0], 4)))
if approx_coords in coords :
continue
else :
names.append(landmark.name)
L_clean.append(landmark)
coords.append(tuple((round(landmark.location[0], 3), round(landmark.location[0], 3))))
coords.append(approx_coords)
return L_clean
@ -245,7 +251,11 @@ def get_landmarks(list_amenity: list, landmarktype: LandmarkType, city_country:
# skip if unused
if 'disused:leisure' in elem.tags().keys():
continue
continue
# skip if part of another building
if 'building:part' in elem.tags().keys() and elem.tag('building:part') == 'yes':
continue
else :
osm_type = elem.type() # Add type : 'way' or 'relation'

View File

@ -3,6 +3,7 @@ from typing import List
from math import pi
from structs.landmarks import Landmark
from landmarks_manager import take_most_important
def create_corridor(landmarks: List[Landmark], width: float) :
@ -25,15 +26,6 @@ def create_linestring(landmarks: List[Landmark])->List[Point] :
return LineString(points)
"""def is_in_area_ring(area: Polygon, coordinates) -> bool :
point = Point(coordinates)
if area.contains(point) :
t = area.interiors[0]
return not t.contains(point)
"""
def is_in_area(area: Polygon, coordinates) -> bool :
point = Point(coordinates)
@ -48,4 +40,4 @@ def get_minor_landmarks(all_landmarks: List[Landmark], visited_landmarks: List[L
if is_in_area(area, landmark.location) and landmark not in visited_landmarks:
second_order_landmarks.append(landmark)
return second_order_landmarks
return take_most_important(second_order_landmarks)

View File

@ -105,13 +105,12 @@ def test4(coordinates: tuple[float, float]) -> List[Landmark]:
#write_data(minor_landmarks, 'minor_landmarks.txt')
print("There are " + str(len(minor_landmarks)) + " minor landmarks around the predicted path")
full_set = visited_list[:-1] + minor_landmarks[:30]
full_set.append(finish)
fuller_list = minor_landmarks + visited_list
new_visit = solve_optimization(fuller_list, max_walking_time*60+detour, True)
new_route = solve_optimization(full_set, max_walking_time*60+detour, True)
return visited_list
return new_route
test4(tuple((48.8795156, 2.3660204)))

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff