Change output for outputDetail=:points_of_interest for a path without POI

master
Max Kannenberg 2022-08-08 16:10:38 +02:00
parent acf8cd0c3b
commit 5e33e62a79
1 changed files with 15 additions and 9 deletions

View File

@ -8,17 +8,23 @@ function createOutput(settings::Settings, drivingCourse::Vector{Dict}, pointsOfI
if settings.outputDetail == :running_time
output::Vector{Dict} = [Dict(:t => drivingCourse[end][:t])]
elseif settings.outputDetail == :points_of_interest && !isempty(pointsOfInterest)
elseif settings.outputDetail == :points_of_interest
# get only the driving course's support points with POI labels
# if there is no point with POI label return the information of departure and arrival (first and last points)
output = Dict[]
supportPoint = 1
for POI in 1:length(pointsOfInterest)
while supportPoint <= length(drivingCourse)
if pointsOfInterest[POI][1] == drivingCourse[supportPoint][:s]
push!(output, drivingCourse[supportPoint])
break
if isempty(pointsOfInterest)
push!(output, drivingCourse[1])
push!(output, drivingCourse[end])
else
supportPoint = 1
for POI in 1:length(pointsOfInterest)
while supportPoint <= length(drivingCourse)
if pointsOfInterest[POI][1] == drivingCourse[supportPoint][:s]
push!(output, drivingCourse[supportPoint])
break
end
supportPoint += 1
end
supportPoint += 1
end
end
@ -34,7 +40,7 @@ function createOutput(settings::Settings, drivingCourse::Vector{Dict}, pointsOfI
end
end
else #if settings.outputDetail == :driving_course || (settings.outputDetail == :points_of_interest && !isempty(path.poi))
elseif settings.outputDetail == :driving_course
output = drivingCourse
end