From 7b5902a580e15c54c5729f44779465258fbb9ddb Mon Sep 17 00:00:00 2001 From: Dennis Luxen Date: Tue, 25 Mar 2014 18:06:05 +0100 Subject: [PATCH] rename phantom nodes members --- DataStructures/PhantomNodes.h | 71 +++++++++++-------- Descriptors/GPXDescriptor.h | 8 +-- Descriptors/JSONDescriptor.h | 18 ++--- Plugins/ViaRoutePlugin.h | 8 +-- RoutingAlgorithms/AlternativePathRouting.h | 62 ++++++++--------- RoutingAlgorithms/BasicRoutingInterface.h | 34 +++++----- RoutingAlgorithms/ShortestPathRouting.h | 79 +++++++++++----------- 7 files changed, 146 insertions(+), 134 deletions(-) diff --git a/DataStructures/PhantomNodes.h b/DataStructures/PhantomNodes.h index e74af6db5..5396c3e60 100644 --- a/DataStructures/PhantomNodes.h +++ b/DataStructures/PhantomNodes.h @@ -34,9 +34,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. struct PhantomNode { PhantomNode() : - forward_node_id( SPECIAL_NODEID ), - reverse_node_id( SPECIAL_NODEID ), - name_id( std::numeric_limits::max() ), + forward_node_id(SPECIAL_NODEID), + reverse_node_id(SPECIAL_NODEID), + name_id(std::numeric_limits::max()), forward_weight(INVALID_EDGE_WEIGHT), reverse_weight(INVALID_EDGE_WEIGHT), forward_offset(0), @@ -59,18 +59,20 @@ struct PhantomNode { unsigned short fwd_segment_position; - int GetForwardWeightPlusOffset() const { + int GetForwardWeightPlusOffset() const + { SimpleLogger().Write(logDEBUG) << "->fwd_offset: " << forward_offset << ", weight: " << forward_weight; return reverse_offset + forward_weight; } - int GetReverseWeightPlusOffset() const { + int GetReverseWeightPlusOffset() const + { SimpleLogger().Write(logDEBUG) << "->rev_offset: " << reverse_offset << ", weight: " << reverse_weight; - return forward_offset + reverse_weight; } - void Reset() { + void Reset() + { forward_node_id = SPECIAL_NODEID; name_id = SPECIAL_NODEID; forward_weight = INVALID_EDGE_WEIGHT; @@ -81,16 +83,19 @@ struct PhantomNode { location.Reset(); } - bool isBidirected() const { - return ( forward_node_id != SPECIAL_NODEID ) && - ( reverse_node_id != SPECIAL_NODEID ); + bool isBidirected() const + { + return (forward_node_id != SPECIAL_NODEID) && + (reverse_node_id != SPECIAL_NODEID); } - bool IsCompressed() const { + bool IsCompressed() const + { return (forward_offset != 0) || (reverse_offset != 0); } - bool isValid(const unsigned numberOfNodes) const { + bool isValid(const unsigned numberOfNodes) const + { return location.isValid() && ( @@ -107,39 +112,45 @@ struct PhantomNode { ); } - bool operator==(const PhantomNode & other) const { + bool operator==(const PhantomNode & other) const + { return location == other.location; } }; -struct PhantomNodes { +struct PhantomNodes +{ //TODO: rename to lower-case non-camel source_*,target_* - PhantomNode startPhantom; - PhantomNode targetPhantom; - void Reset() { - startPhantom.Reset(); - targetPhantom.Reset(); + PhantomNode source_phantom; + PhantomNode target_phantom; + void Reset() + { + source_phantom.Reset(); + target_phantom.Reset(); } - bool PhantomsAreOnSameNodeBasedEdge() const { - return (startPhantom.forward_node_id == targetPhantom.forward_node_id); + bool PhantomsAreOnSameNodeBasedEdge() const + { + return (source_phantom.forward_node_id == target_phantom.forward_node_id); } - bool AtLeastOnePhantomNodeIsInvalid() const { - return ((startPhantom.forward_node_id == SPECIAL_NODEID) && (startPhantom.reverse_node_id == SPECIAL_NODEID)) || - ((targetPhantom.forward_node_id == SPECIAL_NODEID) && (targetPhantom.reverse_node_id == SPECIAL_NODEID)); + bool AtLeastOnePhantomNodeIsInvalid() const + { + return ((source_phantom.forward_node_id == SPECIAL_NODEID) && (source_phantom.reverse_node_id == SPECIAL_NODEID)) || + ((target_phantom.forward_node_id == SPECIAL_NODEID) && (target_phantom.reverse_node_id == SPECIAL_NODEID)); } - bool PhantomNodesHaveEqualLocation() const { - return startPhantom == targetPhantom; + bool PhantomNodesHaveEqualLocation() const + { + return source_phantom == target_phantom; } }; inline std::ostream& operator<<(std::ostream &out, const PhantomNodes & pn) { - // out << "Node1: " << pn.startPhantom.forward_node_id << "\n"; - // out << "Node2: " << pn.targetPhantom.reverse_node_id << "\n"; - out << "start_coord: " << pn.startPhantom.location << "\n"; - out << "target_coord: " << pn.targetPhantom.location << std::endl; + // out << "Node1: " << pn.source_phantom.forward_node_id << "\n"; + // out << "Node2: " << pn.target_phantom.reverse_node_id << "\n"; + out << "source_coord: " << pn.source_phantom.location << "\n"; + out << "target_coord: " << pn.target_phantom.location << std::endl; return out; } diff --git a/Descriptors/GPXDescriptor.h b/Descriptors/GPXDescriptor.h index 105a09abf..7d9a6d680 100644 --- a/Descriptors/GPXDescriptor.h +++ b/Descriptors/GPXDescriptor.h @@ -65,12 +65,12 @@ public: (raw_route.unpacked_path_segments[0].size()); if( found_route ) { FixedPointCoordinate::convertInternalLatLonToString( - phantom_node_list.startPhantom.location.lat, + phantom_node_list.source_phantom.location.lat, tmp ); reply.content.push_back(""); @@ -90,12 +90,12 @@ public: } // Add the via point or the end coordinate FixedPointCoordinate::convertInternalLatLonToString( - phantom_node_list.targetPhantom.location.lat, + phantom_node_list.target_phantom.location.lat, tmp ); reply.content.push_back(""); diff --git a/Descriptors/JSONDescriptor.h b/Descriptors/JSONDescriptor.h index 2d367a9cc..5415cc5ed 100644 --- a/Descriptors/JSONDescriptor.h +++ b/Descriptors/JSONDescriptor.h @@ -101,7 +101,7 @@ public: description_factory.AppendSegment(current_coordinate, path_data ); ++added_element_count; } - // description_factory.SetEndSegment( leg_phantoms.targetPhantom ); + // description_factory.SetEndSegment( leg_phantoms.target_phantom ); ++added_element_count; BOOST_ASSERT( (int)(route_leg.size() + 1) == added_element_count ); return added_element_count; @@ -127,7 +127,7 @@ public: return; } - description_factory.SetStartSegment(phantom_nodes.startPhantom); + description_factory.SetStartSegment(phantom_nodes.source_phantom); reply.content.push_back("0," "\"status_message\": \"Found route between points\","); @@ -142,7 +142,7 @@ public: added_segments + shortest_leg_end_indices.back() ); } - description_factory.SetEndSegment(phantom_nodes.targetPhantom); + description_factory.SetEndSegment(phantom_nodes.target_phantom); description_factory.Run(facade, config.zoom_level); reply.content.push_back("\"route_geometry\": "); @@ -195,13 +195,13 @@ public: //only one alternative route is computed at this time, so this is hardcoded if(raw_route.lengthOfAlternativePath != INT_MAX) { - alternate_descriptionFactory.SetStartSegment(phantom_nodes.startPhantom); + alternate_descriptionFactory.SetStartSegment(phantom_nodes.source_phantom); //Get all the coordinates for the computed route BOOST_FOREACH(const PathData & path_data, raw_route.unpacked_alternative) { current = facade->GetCoordinateOfNode(path_data.node); alternate_descriptionFactory.AppendSegment(current, path_data ); } - alternate_descriptionFactory.SetEndSegment(phantom_nodes.targetPhantom); + alternate_descriptionFactory.SetEndSegment(phantom_nodes.target_phantom); } alternate_descriptionFactory.Run(facade, config.zoom_level); @@ -286,7 +286,7 @@ public: std::string tmp; FixedPointCoordinate::convertInternalReversedCoordinateToString( - raw_route.segmentEndCoordinates.front().startPhantom.location, + raw_route.segmentEndCoordinates.front().source_phantom.location, tmp ); reply.content.push_back("["); @@ -296,7 +296,7 @@ public: BOOST_FOREACH(const PhantomNodes & nodes, raw_route.segmentEndCoordinates) { tmp.clear(); FixedPointCoordinate::convertInternalReversedCoordinateToString( - nodes.targetPhantom.location, + nodes.target_phantom.location, tmp ); reply.content.push_back(",["); @@ -332,11 +332,11 @@ public: std::string hint; for(unsigned i = 0; i < raw_route.segmentEndCoordinates.size(); ++i) { reply.content.push_back("\""); - EncodeObjectToBase64(raw_route.segmentEndCoordinates[i].startPhantom, hint); + EncodeObjectToBase64(raw_route.segmentEndCoordinates[i].source_phantom, hint); reply.content.push_back(hint); reply.content.push_back("\", "); } - EncodeObjectToBase64(raw_route.segmentEndCoordinates.back().targetPhantom, hint); + EncodeObjectToBase64(raw_route.segmentEndCoordinates.back().target_phantom, hint); reply.content.push_back("\""); reply.content.push_back(hint); reply.content.push_back("\"]"); diff --git a/Plugins/ViaRoutePlugin.h b/Plugins/ViaRoutePlugin.h index 5f25f20bc..6242f172e 100644 --- a/Plugins/ViaRoutePlugin.h +++ b/Plugins/ViaRoutePlugin.h @@ -112,8 +112,8 @@ public: PhantomNodes segmentPhantomNodes; for(unsigned i = 0; i < phantomNodeVector.size()-1; ++i) { - segmentPhantomNodes.startPhantom = phantomNodeVector[i]; - segmentPhantomNodes.targetPhantom = phantomNodeVector[i+1]; + segmentPhantomNodes.source_phantom = phantomNodeVector[i]; + segmentPhantomNodes.target_phantom = phantomNodeVector[i+1]; rawRoute.segmentEndCoordinates.push_back(segmentPhantomNodes); } @@ -172,8 +172,8 @@ public: } PhantomNodes phantomNodes; - phantomNodes.startPhantom = rawRoute.segmentEndCoordinates[0].startPhantom; - phantomNodes.targetPhantom = rawRoute.segmentEndCoordinates[rawRoute.segmentEndCoordinates.size()-1].targetPhantom; + phantomNodes.source_phantom = rawRoute.segmentEndCoordinates[0].source_phantom; + phantomNodes.target_phantom = rawRoute.segmentEndCoordinates[rawRoute.segmentEndCoordinates.size()-1].target_phantom; desc->SetConfig(descriptorConfig); desc->Run(rawRoute, phantomNodes, facade, reply); diff --git a/RoutingAlgorithms/AlternativePathRouting.h b/RoutingAlgorithms/AlternativePathRouting.h index 05a2895e4..589bbb393 100644 --- a/RoutingAlgorithms/AlternativePathRouting.h +++ b/RoutingAlgorithms/AlternativePathRouting.h @@ -119,45 +119,45 @@ public: int upper_bound_to_shortest_path_distance = INVALID_EDGE_WEIGHT; NodeID middle_node = SPECIAL_NODEID; - if(phantom_node_pair.startPhantom.forward_node_id != SPECIAL_NODEID ) { - SimpleLogger().Write(logDEBUG) << "fwd insert: " << phantom_node_pair.startPhantom.forward_node_id << ", w: " << -phantom_node_pair.startPhantom.GetForwardWeightPlusOffset(); + if(phantom_node_pair.source_phantom.forward_node_id != SPECIAL_NODEID ) { + SimpleLogger().Write(logDEBUG) << "fwd insert: " << phantom_node_pair.source_phantom.forward_node_id << ", w: " << -phantom_node_pair.source_phantom.GetForwardWeightPlusOffset(); forward_heap1.Insert( - phantom_node_pair.startPhantom.forward_node_id, - -phantom_node_pair.startPhantom.GetForwardWeightPlusOffset(), - phantom_node_pair.startPhantom.forward_node_id + phantom_node_pair.source_phantom.forward_node_id, + -phantom_node_pair.source_phantom.GetForwardWeightPlusOffset(), + phantom_node_pair.source_phantom.forward_node_id ); } - if(phantom_node_pair.startPhantom.reverse_node_id != SPECIAL_NODEID ) { - SimpleLogger().Write(logDEBUG) << "fwd insert: " << phantom_node_pair.startPhantom.reverse_node_id << ", w: " << -phantom_node_pair.startPhantom.GetReverseWeightPlusOffset(); + if(phantom_node_pair.source_phantom.reverse_node_id != SPECIAL_NODEID ) { + SimpleLogger().Write(logDEBUG) << "fwd insert: " << phantom_node_pair.source_phantom.reverse_node_id << ", w: " << -phantom_node_pair.source_phantom.GetReverseWeightPlusOffset(); forward_heap1.Insert( - phantom_node_pair.startPhantom.reverse_node_id, - -phantom_node_pair.startPhantom.GetReverseWeightPlusOffset(), - phantom_node_pair.startPhantom.reverse_node_id + phantom_node_pair.source_phantom.reverse_node_id, + -phantom_node_pair.source_phantom.GetReverseWeightPlusOffset(), + phantom_node_pair.source_phantom.reverse_node_id ); } - if(phantom_node_pair.targetPhantom.forward_node_id != SPECIAL_NODEID ) { - SimpleLogger().Write(logDEBUG) << "rev insert: " << phantom_node_pair.targetPhantom.forward_node_id << ", w: " << phantom_node_pair.targetPhantom.GetForwardWeightPlusOffset(); + if(phantom_node_pair.target_phantom.forward_node_id != SPECIAL_NODEID ) { + SimpleLogger().Write(logDEBUG) << "rev insert: " << phantom_node_pair.target_phantom.forward_node_id << ", w: " << phantom_node_pair.target_phantom.GetForwardWeightPlusOffset(); reverse_heap1.Insert( - phantom_node_pair.targetPhantom.forward_node_id, - phantom_node_pair.targetPhantom.GetForwardWeightPlusOffset(), - phantom_node_pair.targetPhantom.forward_node_id + phantom_node_pair.target_phantom.forward_node_id, + phantom_node_pair.target_phantom.GetForwardWeightPlusOffset(), + phantom_node_pair.target_phantom.forward_node_id ); } - if(phantom_node_pair.targetPhantom.reverse_node_id != SPECIAL_NODEID ) { - SimpleLogger().Write(logDEBUG) << "rev insert: " << phantom_node_pair.targetPhantom.reverse_node_id << ", w: " << phantom_node_pair.targetPhantom.GetReverseWeightPlusOffset(); + if(phantom_node_pair.target_phantom.reverse_node_id != SPECIAL_NODEID ) { + SimpleLogger().Write(logDEBUG) << "rev insert: " << phantom_node_pair.target_phantom.reverse_node_id << ", w: " << phantom_node_pair.target_phantom.GetReverseWeightPlusOffset(); reverse_heap1.Insert( - phantom_node_pair.targetPhantom.reverse_node_id, - phantom_node_pair.targetPhantom.GetReverseWeightPlusOffset(), - phantom_node_pair.targetPhantom.reverse_node_id + phantom_node_pair.target_phantom.reverse_node_id, + phantom_node_pair.target_phantom.GetReverseWeightPlusOffset(), + phantom_node_pair.target_phantom.reverse_node_id ); } const int forward_offset = super::ComputeEdgeOffset( - phantom_node_pair.startPhantom + phantom_node_pair.source_phantom ); const int reverse_offset = super::ComputeEdgeOffset( - phantom_node_pair.targetPhantom + phantom_node_pair.target_phantom ); SimpleLogger().Write(logDEBUG) << "fwd_offset: " << forward_offset << ", reverse_offset: " << reverse_offset; @@ -319,17 +319,17 @@ public: if( INVALID_EDGE_WEIGHT != upper_bound_to_shortest_path_distance ) { BOOST_ASSERT( !packed_shortest_path.empty() ); raw_route_data.unpacked_path_segments.resize(1); - // SimpleLogger().Write() << "fwd offset1: " << phantom_node_pair.startPhantom.fwd_segment_position; - // SimpleLogger().Write() << "fwd offset2: " << phantom_node_pair.startPhantom.rev_segment_position; - // SimpleLogger().Write() << "rev offset1: " << phantom_node_pair.targetPhantom.fwd_segment_position; - // SimpleLogger().Write() << "rev offset2: " << phantom_node_pair.targetPhantom.rev_segment_position; + // SimpleLogger().Write() << "fwd offset1: " << phantom_node_pair.source_phantom.fwd_segment_position; + // SimpleLogger().Write() << "fwd offset2: " << phantom_node_pair.source_phantom.rev_segment_position; + // SimpleLogger().Write() << "rev offset1: " << phantom_node_pair.target_phantom.fwd_segment_position; + // SimpleLogger().Write() << "rev offset2: " << phantom_node_pair.target_phantom.rev_segment_position; - // int start_offset = ( packed_shortest_path.front() == phantom_node_pair.startPhantom.forward_node_id ? 1 : -1 )*phantom_node_pair.startPhantom.fwd_segment_position; - // SimpleLogger().Write(logDEBUG) << "unpacking from index " << phantom_node_pair.startPhantom.fwd_segment_position; + // int start_offset = ( packed_shortest_path.front() == phantom_node_pair.source_phantom.forward_node_id ? 1 : -1 )*phantom_node_pair.source_phantom.fwd_segment_position; + // SimpleLogger().Write(logDEBUG) << "unpacking from index " << phantom_node_pair.source_phantom.fwd_segment_position; - // SimpleLogger().Write(logDEBUG) << "phantom_node_pair.startPhantom.forward_node_id: " << phantom_node_pair.startPhantom.forward_node_id; - // SimpleLogger().Write(logDEBUG) << "phantom_node_pair.startPhantom.reverse_node_id: " << phantom_node_pair.startPhantom.reverse_node_id; - // SimpleLogger().Write(logDEBUG) << "phantom_node_pair.targetPhantom.packed_geometry_id: " << phantom_node_pair.targetPhantom.packed_geometry_id; + // SimpleLogger().Write(logDEBUG) << "phantom_node_pair.source_phantom.forward_node_id: " << phantom_node_pair.source_phantom.forward_node_id; + // SimpleLogger().Write(logDEBUG) << "phantom_node_pair.source_phantom.reverse_node_id: " << phantom_node_pair.source_phantom.reverse_node_id; + // SimpleLogger().Write(logDEBUG) << "phantom_node_pair.target_phantom.packed_geometry_id: " << phantom_node_pair.target_phantom.packed_geometry_id; // SimpleLogger().Write(logDEBUG) << "packed_shortest_path.back(): " << packed_shortest_path.back(); super::UnpackPath( diff --git a/RoutingAlgorithms/BasicRoutingInterface.h b/RoutingAlgorithms/BasicRoutingInterface.h index 7e777d675..69a02e0e2 100644 --- a/RoutingAlgorithms/BasicRoutingInterface.h +++ b/RoutingAlgorithms/BasicRoutingInterface.h @@ -147,8 +147,8 @@ public: std::vector & unpacked_path ) const { // SimpleLogger().Write(logDEBUG) << "packed_path.size: " << packed_path.size(); - const bool start_traversed_in_reverse = (packed_path.front() != phantom_node_pair.startPhantom.forward_node_id); - const bool target_traversed_in_reverse = (packed_path.back() != phantom_node_pair.targetPhantom.forward_node_id); + const bool start_traversed_in_reverse = (packed_path.front() != phantom_node_pair.source_phantom.forward_node_id); + const bool target_traversed_in_reverse = (packed_path.back() != phantom_node_pair.target_phantom.forward_node_id); const unsigned packed_path_size = packed_path.size(); std::stack > recursion_stack; @@ -232,7 +232,7 @@ public: std::vector id_vector; facade->GetUncompressedGeometry(facade->GetGeometryIndexForEdgeID(ed.id), id_vector); - const int start_index = ( unpacked_path.empty() ? ( ( start_traversed_in_reverse ) ? id_vector.size() - phantom_node_pair.startPhantom.fwd_segment_position - 1 : phantom_node_pair.startPhantom.fwd_segment_position ) : 0 ); + const int start_index = ( unpacked_path.empty() ? ( ( start_traversed_in_reverse ) ? id_vector.size() - phantom_node_pair.source_phantom.fwd_segment_position - 1 : phantom_node_pair.source_phantom.fwd_segment_position ) : 0 ); const int end_index = id_vector.size(); BOOST_ASSERT( start_index >= 0 ); @@ -256,40 +256,40 @@ public: } } } - if(SPECIAL_EDGEID != phantom_node_pair.targetPhantom.packed_geometry_id ) { - // SimpleLogger().Write(logDEBUG) << "unpacking last segment " << phantom_node_pair.targetPhantom.packed_geometry_id; + if(SPECIAL_EDGEID != phantom_node_pair.target_phantom.packed_geometry_id ) { + // SimpleLogger().Write(logDEBUG) << "unpacking last segment " << phantom_node_pair.target_phantom.packed_geometry_id; // SimpleLogger().Write(logDEBUG) << "start_traversed_in_reverse: " << (start_traversed_in_reverse ? "y" : "n"); // SimpleLogger().Write(logDEBUG) << "target_traversed_in_reverse: " << (target_traversed_in_reverse ? "y" : "n"); - // SimpleLogger().Write(logDEBUG) << "phantom_node_pair.startPhantom.fwd_segment_position: " << phantom_node_pair.startPhantom.fwd_segment_position << ", " << - // "phantom_node_pair.targetPhantom.fwd_segment_position: " << phantom_node_pair.targetPhantom.fwd_segment_position; + // SimpleLogger().Write(logDEBUG) << "phantom_node_pair.source_phantom.fwd_segment_position: " << phantom_node_pair.source_phantom.fwd_segment_position << ", " << + // "phantom_node_pair.target_phantom.fwd_segment_position: " << phantom_node_pair.target_phantom.fwd_segment_position; std::vector id_vector; - facade->GetUncompressedGeometry(phantom_node_pair.targetPhantom.packed_geometry_id, id_vector); + facade->GetUncompressedGeometry(phantom_node_pair.target_phantom.packed_geometry_id, id_vector); if( target_traversed_in_reverse ) { std::reverse(id_vector.begin(), id_vector.end() ); } // SimpleLogger().Write(logDEBUG) << "id_vector.size() " << id_vector.size(); // SimpleLogger().Write(logDEBUG) << "unpacked_path.empty()=" << (unpacked_path.empty() ? "y" : "n"); - const bool is_local_path = (phantom_node_pair.startPhantom.packed_geometry_id == phantom_node_pair.targetPhantom.packed_geometry_id) && unpacked_path.empty(); - // SimpleLogger().Write(logDEBUG) << "is_local_path: " << (is_local_path ? "y" : "n"); + const bool is_local_path = (phantom_node_pair.source_phantom.packed_geometry_id == phantom_node_pair.target_phantom.packed_geometry_id) && unpacked_path.empty(); + // SimpleLogger().Write(logDEBUG) << "is_loc_pl_path: " << (is_local_path ? "y" : "n"); int start_index = 0; - int end_index = phantom_node_pair.targetPhantom.fwd_segment_position; + int end_index = phantom_node_pair.target_phantom.fwd_segment_position; // SimpleLogger().Write(logDEBUG) << "case1"; if (target_traversed_in_reverse) { - end_index = id_vector.size() - phantom_node_pair.targetPhantom.fwd_segment_position; + end_index = id_vector.size() - phantom_node_pair.target_phantom.fwd_segment_position; } if (is_local_path) { // SimpleLogger().Write(logDEBUG) << "case3"; - start_index = phantom_node_pair.startPhantom.fwd_segment_position; - end_index = phantom_node_pair.targetPhantom.fwd_segment_position; + start_index = phantom_node_pair.source_phantom.fwd_segment_position; + end_index = phantom_node_pair.target_phantom.fwd_segment_position; if (target_traversed_in_reverse) { // SimpleLogger().Write(logDEBUG) << "case4"; - start_index = id_vector.size() - phantom_node_pair.startPhantom.fwd_segment_position; - end_index = id_vector.size() - phantom_node_pair.targetPhantom.fwd_segment_position; + start_index = id_vector.size() - phantom_node_pair.source_phantom.fwd_segment_position; + end_index = id_vector.size() - phantom_node_pair.target_phantom.fwd_segment_position; } } @@ -309,7 +309,7 @@ public: unpacked_path.push_back( PathData( id_vector[i], - phantom_node_pair.targetPhantom.name_id, + phantom_node_pair.target_phantom.name_id, TurnInstructionsClass::NoTurn, 0 ) diff --git a/RoutingAlgorithms/ShortestPathRouting.h b/RoutingAlgorithms/ShortestPathRouting.h index 2dbcea798..e76493335 100644 --- a/RoutingAlgorithms/ShortestPathRouting.h +++ b/RoutingAlgorithms/ShortestPathRouting.h @@ -48,14 +48,15 @@ public: ) : super(facade), engine_working_data(engine_working_data) - {} + { } - ~ShortestPathRouting() {} + ~ShortestPathRouting() { } void operator()( const std::vector & phantom_nodes_vector, RawRouteData & raw_route_data - ) const { + ) const + { BOOST_FOREACH( const PhantomNodes & phantom_node_pair, phantom_nodes_vector @@ -108,61 +109,61 @@ public: //insert new starting nodes into forward heap, adjusted by previous distances. if( search_from_1st_node && - phantom_node_pair.startPhantom.forward_node_id != SPECIAL_NODEID + phantom_node_pair.source_phantom.forward_node_id != SPECIAL_NODEID ) { - SimpleLogger().Write(logDEBUG) << "fwd1 insert: " << phantom_node_pair.startPhantom.forward_node_id << ", w: " << -phantom_node_pair.startPhantom.GetForwardWeightPlusOffset(); + SimpleLogger().Write(logDEBUG) << "fwd1 insert: " << phantom_node_pair.source_phantom.forward_node_id << ", w: " << -phantom_node_pair.source_phantom.GetForwardWeightPlusOffset(); forward_heap1.Insert( - phantom_node_pair.startPhantom.forward_node_id, - distance1-phantom_node_pair.startPhantom.GetForwardWeightPlusOffset(), - phantom_node_pair.startPhantom.forward_node_id + phantom_node_pair.source_phantom.forward_node_id, + distance1-phantom_node_pair.source_phantom.GetForwardWeightPlusOffset(), + phantom_node_pair.source_phantom.forward_node_id ); forward_heap2.Insert( - phantom_node_pair.startPhantom.forward_node_id, - distance1-phantom_node_pair.startPhantom.GetForwardWeightPlusOffset(), - phantom_node_pair.startPhantom.forward_node_id + phantom_node_pair.source_phantom.forward_node_id, + distance1-phantom_node_pair.source_phantom.GetForwardWeightPlusOffset(), + phantom_node_pair.source_phantom.forward_node_id ); } if( search_from_2nd_node && - phantom_node_pair.startPhantom.reverse_node_id != SPECIAL_NODEID + phantom_node_pair.source_phantom.reverse_node_id != SPECIAL_NODEID ) { - SimpleLogger().Write(logDEBUG) << "fwd1 insert: " << phantom_node_pair.startPhantom.reverse_node_id << ", w: " << -phantom_node_pair.startPhantom.GetReverseWeightPlusOffset(); + SimpleLogger().Write(logDEBUG) << "fwd1 insert: " << phantom_node_pair.source_phantom.reverse_node_id << ", w: " << -phantom_node_pair.source_phantom.GetReverseWeightPlusOffset(); forward_heap1.Insert( - phantom_node_pair.startPhantom.reverse_node_id, - distance2-phantom_node_pair.startPhantom.GetReverseWeightPlusOffset(), - phantom_node_pair.startPhantom.reverse_node_id + phantom_node_pair.source_phantom.reverse_node_id, + distance2-phantom_node_pair.source_phantom.GetReverseWeightPlusOffset(), + phantom_node_pair.source_phantom.reverse_node_id ); forward_heap2.Insert( - phantom_node_pair.startPhantom.reverse_node_id, - distance2-phantom_node_pair.startPhantom.GetReverseWeightPlusOffset(), - phantom_node_pair.startPhantom.reverse_node_id + phantom_node_pair.source_phantom.reverse_node_id, + distance2-phantom_node_pair.source_phantom.GetReverseWeightPlusOffset(), + phantom_node_pair.source_phantom.reverse_node_id ); } //insert new backward nodes into backward heap, unadjusted. - if( phantom_node_pair.targetPhantom.forward_node_id != SPECIAL_NODEID ) { - SimpleLogger().Write(logDEBUG) << "rev insert: " << phantom_node_pair.targetPhantom.forward_node_id << ", w: " << phantom_node_pair.targetPhantom.GetForwardWeightPlusOffset(); + if( phantom_node_pair.target_phantom.forward_node_id != SPECIAL_NODEID ) { + SimpleLogger().Write(logDEBUG) << "rev insert: " << phantom_node_pair.target_phantom.forward_node_id << ", w: " << phantom_node_pair.target_phantom.GetForwardWeightPlusOffset(); reverse_heap1.Insert( - phantom_node_pair.targetPhantom.forward_node_id, - phantom_node_pair.targetPhantom.GetForwardWeightPlusOffset(), - phantom_node_pair.targetPhantom.forward_node_id + phantom_node_pair.target_phantom.forward_node_id, + phantom_node_pair.target_phantom.GetForwardWeightPlusOffset(), + phantom_node_pair.target_phantom.forward_node_id ); } - if( phantom_node_pair.targetPhantom.reverse_node_id != SPECIAL_NODEID ) { - SimpleLogger().Write(logDEBUG) << "rev insert: " << phantom_node_pair.targetPhantom.reverse_node_id << ", w: " << phantom_node_pair.targetPhantom.GetReverseWeightPlusOffset(); + if( phantom_node_pair.target_phantom.reverse_node_id != SPECIAL_NODEID ) { + SimpleLogger().Write(logDEBUG) << "rev insert: " << phantom_node_pair.target_phantom.reverse_node_id << ", w: " << phantom_node_pair.target_phantom.GetReverseWeightPlusOffset(); reverse_heap2.Insert( - phantom_node_pair.targetPhantom.reverse_node_id, - phantom_node_pair.targetPhantom.GetReverseWeightPlusOffset(), - phantom_node_pair.targetPhantom.reverse_node_id + phantom_node_pair.target_phantom.reverse_node_id, + phantom_node_pair.target_phantom.GetReverseWeightPlusOffset(), + phantom_node_pair.target_phantom.reverse_node_id ); } const int forward_offset = super::ComputeEdgeOffset( - phantom_node_pair.startPhantom + phantom_node_pair.source_phantom ); const int reverse_offset = super::ComputeEdgeOffset( - phantom_node_pair.targetPhantom + phantom_node_pair.target_phantom ); //run two-Target Dijkstra routing step. @@ -348,11 +349,11 @@ public: if( (packed_legs1[current_leg].back() == packed_legs2[current_leg].back()) && - phantom_node_pair.targetPhantom.isBidirected() + phantom_node_pair.target_phantom.isBidirected() ) { const NodeID last_node_id = packed_legs2[current_leg].back(); - search_from_1st_node &= !(last_node_id == phantom_node_pair.targetPhantom.reverse_node_id); - search_from_2nd_node &= !(last_node_id == phantom_node_pair.targetPhantom.forward_node_id); + search_from_1st_node &= !(last_node_id == phantom_node_pair.target_phantom.reverse_node_id); + search_from_2nd_node &= !(last_node_id == phantom_node_pair.target_phantom.forward_node_id); BOOST_ASSERT( search_from_1st_node != search_from_2nd_node ); } @@ -365,7 +366,7 @@ public: std::swap( packed_legs1, packed_legs2 ); } raw_route_data.unpacked_path_segments.resize( packed_legs1.size() ); - // const int start_offset = ( packed_legs1[0].front() == phantom_nodes_vector.front().startPhantom.forward_node_id ? 1 : -1 )*phantom_nodes_vector.front().startPhantom.fwd_segment_position; + // const int start_offset = ( packed_legs1[0].front() == phantom_nodes_vector.front().source_phantom.forward_node_id ? 1 : -1 )*phantom_nodes_vector.front().source_phantom.fwd_segment_position; for(unsigned i = 0; i < packed_legs1.size(); ++i){ BOOST_ASSERT( !phantom_nodes_vector.empty() ); @@ -376,14 +377,14 @@ public: PhantomNodes unpack_phantom_node_pair = phantom_nodes_vector[i]; // if (!at_beginning) // { - // unpack_phantom_node_pair.startPhantom.packed_geometry_id = SPECIAL_EDGEID; - // unpack_phantom_node_pair.startPhantom.fwd_segment_position = 0; + // unpack_phantom_node_pair.source_phantom.packed_geometry_id = SPECIAL_EDGEID; + // unpack_phantom_node_pair.source_phantom.fwd_segment_position = 0; // } // if (!at_end) // { - // unpack_phantom_node_pair.targetPhantom.packed_geometry_id = SPECIAL_EDGEID; - // unpack_phantom_node_pair.targetPhantom.fwd_segment_position = 0; + // unpack_phantom_node_pair.target_phantom.packed_geometry_id = SPECIAL_EDGEID; + // unpack_phantom_node_pair.target_phantom.fwd_segment_position = 0; // } super::UnpackPath(