@@ -199,11 +199,11 @@ end
199199
200200
201201"""
202- add_node_and_edge_mappings!(g::OSMGraph{U,T,W}) where {U <: Integer ,T <: Integer ,W <: Real}
202+ add_node_and_edge_mappings!(g::OSMGraph{U,T,W}) where {U <: DEFAULT_OSM_INDEX_TYPE ,T <: DEFAULT_OSM_ID_TYPE ,W <: Real}
203203
204204Adds mappings between nodes, edges and ways to `OSMGraph`.
205205"""
206- function add_node_and_edge_mappings! (g:: OSMGraph{U,T,W} ) where {U <: Integer ,T <: Integer ,W <: Real }
206+ function add_node_and_edge_mappings! (g:: OSMGraph{U,T,W} ) where {U <: DEFAULT_OSM_INDEX_TYPE ,T <: DEFAULT_OSM_ID_TYPE ,W <: Real }
207207 for (way_id, way) in g. ways
208208 @inbounds for (i, node_id) in enumerate (way. nodes)
209209 if haskey (g. node_to_way, node_id)
@@ -266,11 +266,11 @@ function add_node_tags!(g::OSMGraph)
266266end
267267
268268"""
269- adjacent_node(g::OSMGraph, node::T, way::T)::Union{T,Vector{<:T}} where T <: Integer
269+ adjacent_node(g::OSMGraph, node::T, way::T)::Union{T,Vector{<:T}} where T <: DEFAULT_OSM_ID_TYPE
270270
271271Finds the adjacent node id on a given way.
272272"""
273- function adjacent_node (g:: OSMGraph , node:: T , way:: T ):: Union{T,Vector{<:T}} where T <: Integer
273+ function adjacent_node (g:: OSMGraph , node:: T , way:: T ):: Union{T,Vector{<:T}} where T <: DEFAULT_OSM_ID_TYPE
274274 way_nodes = g. ways[way]. nodes
275275 if node == way_nodes[1 ]
276276 return way_nodes[2 ]
@@ -293,14 +293,14 @@ function adjacent_node(g::OSMGraph, node::T, way::T)::Union{T,Vector{<:T}} where
293293end
294294
295295"""
296- add_indexed_restrictions!(g::OSMGraph{U,T,W}) where {U <: Integer, T <: Integer, W <: Real}
296+ add_indexed_restrictions!(g::OSMGraph{U,T,W}) where {U <: DEFAULT_OSM_INDEX_TYPE, T <: DEFAULT_OSM_ID_TYPE, W <: Real}
297297
298298Adds restrictions linked lists to `OSMGraph`.
299299
300300# Example
301301`[from_way_node_index, ...via_way_node_indices..., to_way_node_index]`
302302"""
303- function add_indexed_restrictions! (g:: OSMGraph{U,T,W} ) where {U <: Integer ,T <: Integer ,W <: Real }
303+ function add_indexed_restrictions! (g:: OSMGraph{U,T,W} ) where {U <: DEFAULT_OSM_INDEX_TYPE ,T <: DEFAULT_OSM_ID_TYPE ,W <: Real }
304304 g. indexed_restrictions = DefaultDict {U,Vector{MutableLinkedList{U}}} (Vector{MutableLinkedList{U}})
305305
306306 for (id, r) in g. restrictions
@@ -321,7 +321,7 @@ function add_indexed_restrictions!(g::OSMGraph{U,T,W}) where {U <: Integer,T <:
321321 from_node = adjacent_node (g, r. via_node, r. from_way):: T
322322 for to_way in restricted_to_ways
323323 to_node_temp = adjacent_node (g, r. via_node, to_way)
324- to_node = isa (to_node_temp, Integer ) ? [to_node_temp] : to_node_temp
324+ to_node = isa (to_node_temp, DEFAULT_OSM_ID_TYPE ) ? [to_node_temp] : to_node_temp
325325
326326 for tn in to_node
327327 # only_straight_on restrictions may have multiple to_nodes
@@ -399,19 +399,19 @@ function add_weights!(g::OSMGraph, weight_type::Symbol=:distance)
399399end
400400
401401"""
402- add_graph!(g::OSMGraph, graph_type::Symbol=:static)
402+ add_graph!(g::OSMGraph{U, T, W}, graph_type::Symbol=:static) where {U <: DEFAULT_OSM_INDEX_TYPE, T <: DEFAULT_OSM_ID_TYPE, W <: Real}
403403
404404Adds a Graphs.AbstractGraph object to `OSMGraph`.
405405"""
406- function add_graph! (g:: OSMGraph{U, T, W} , graph_type:: Symbol = :static ) where {U <: Integer , T <: Integer , W <: Real }
406+ function add_graph! (g:: OSMGraph{U, T, W} , graph_type:: Symbol = :static ) where {U <: DEFAULT_OSM_INDEX_TYPE , T <: DEFAULT_OSM_ID_TYPE , W <: Real }
407407 if graph_type == :light
408- g. graph = DiGraph {T } (g. weights)
408+ g. graph = DiGraph {U } (g. weights)
409409 elseif graph_type == :static
410410 g. graph = StaticDiGraph {U,U} (StaticDiGraph (DiGraph (g. weights)))
411411 elseif graph_type == :simple_weighted
412412 g. graph = SimpleWeightedDiGraph {U,W} (g. weights)
413413 elseif graph_type == :meta
414- g. graph = MetaDiGraph (DiGraph {T } (g. weights))
414+ g. graph = MetaDiGraph (DiGraph {U } (g. weights))
415415 for (o, d, w) in zip (findnz (copy (transpose (g. weights)))... )
416416 set_prop! (g. graph, o, d, :weight , w)
417417 end
@@ -456,7 +456,7 @@ function trim_to_largest_connected_component!(g::OSMGraph{U, T, W}, graph, weigh
456456end
457457
458458"""
459- add_dijkstra_states!(g::OSMGraph{U,T,W}) where {U <: Integer ,T <: Integer ,W <: Real}
459+ add_dijkstra_states!(g::OSMGraph{U,T,W}) where {U <: DEFAULT_OSM_INDEX_TYPE ,T <: DEFAULT_OSM_ID_TYPE ,W <: Real}
460460
461461Adds precomputed dijkstra states for every source node in `OSMGraph`. Precomputing all dijkstra
462462states is a O(V² + ElogV) operation, where E is the number of edges and V is the number of vertices,
@@ -465,9 +465,9 @@ may not be possible for larger graphs. Not recommended for graphs with greater t
465465Note: Not using `cost_adjustment`, i.e. not consdering restrictions in dijkstra computation,
466466consider adding in the future.
467467"""
468- function add_dijkstra_states! (g:: OSMGraph{U,T,W} ) where {U <: Integer ,T <: Integer ,W <: Real }
468+ function add_dijkstra_states! (g:: OSMGraph{U,T,W} ) where {U <: DEFAULT_OSM_INDEX_TYPE ,T <: DEFAULT_OSM_ID_TYPE ,W <: Real }
469469 @warn " Precomputing all dijkstra states is a O(V² + ElogV) operation, may not be possible for larger graphs."
470- g. dijkstra_states = Vector {Vector{U}} (undef, n )
470+ g. dijkstra_states = Vector {Vector{U}} (undef, nv (g . graph) )
471471 set_dijkstra_state! (g, collect (vertices (g. graph)))
472472end
473473
@@ -480,7 +480,7 @@ Returns a 3-by-n matrix where each column is the `xyz` coordinates of a node. Co
480480correspond to the `g.graph` vertex indices.
481481"""
482482function get_cartesian_locations (g:: OSMGraph )
483- node_locations = [index_to_node (g, index). location for index in 1 : nv (g. graph)]
483+ node_locations = [index_to_node (g, index). location for index in DEFAULT_OSM_INDEX_TYPE ( 1 ) : DEFAULT_OSM_INDEX_TYPE ( nv (g. graph) )]
484484 return to_cartesian (node_locations)
485485end
486486
0 commit comments