diff --git a/data_structures/phantom_node.hpp b/data_structures/phantom_node.hpp index 0356e851f..d22cb9504 100644 --- a/data_structures/phantom_node.hpp +++ b/data_structures/phantom_node.hpp @@ -55,6 +55,28 @@ struct PhantomNode PhantomNode(); + template PhantomNode(const OtherT &other, const FixedPointCoordinate &foot_point) + { + forward_node_id = other.forward_edge_based_node_id; + reverse_node_id = other.reverse_edge_based_node_id; + name_id = other.name_id; + + forward_weight = other.forward_weight; + reverse_weight = other.reverse_weight; + + forward_offset = other.forward_offset; + reverse_offset = other.reverse_offset; + + packed_geometry_id = other.packed_geometry_id; + component_id = other.component_id; + + location = foot_point; + fwd_segment_position = other.fwd_segment_position; + + forward_travel_mode = other.forward_travel_mode; + backward_travel_mode = other.backward_travel_mode; + } + NodeID forward_node_id; NodeID reverse_node_id; unsigned name_id; @@ -83,14 +105,13 @@ struct PhantomNode bool is_in_tiny_component() const; - bool operator==(const PhantomNode & other) const; + bool operator==(const PhantomNode &other) const; }; using PhantomNodeArray = std::vector>; class phantom_node_pair : public std::pair { - }; struct PhantomNodeLists @@ -105,26 +126,26 @@ struct PhantomNodes PhantomNode target_phantom; }; -inline std::ostream& operator<<(std::ostream &out, const PhantomNodes & pn) +inline std::ostream &operator<<(std::ostream &out, const PhantomNodes &pn) { out << "source_coord: " << pn.source_phantom.location << "\n"; out << "target_coord: " << pn.target_phantom.location << std::endl; return out; } -inline std::ostream& operator<<(std::ostream &out, const PhantomNode & pn) +inline std::ostream &operator<<(std::ostream &out, const PhantomNode &pn) { - out << "node1: " << pn.forward_node_id << ", " << - "node2: " << pn.reverse_node_id << ", " << - "name: " << pn.name_id << ", " << - "fwd-w: " << pn.forward_weight << ", " << - "rev-w: " << pn.reverse_weight << ", " << - "fwd-o: " << pn.forward_offset << ", " << - "rev-o: " << pn.reverse_offset << ", " << - "geom: " << pn.packed_geometry_id << ", " << - "comp: " << pn.component_id << ", " << - "pos: " << pn.fwd_segment_position << ", " << - "loc: " << pn.location; + out << "node1: " << pn.forward_node_id << ", " + << "node2: " << pn.reverse_node_id << ", " + << "name: " << pn.name_id << ", " + << "fwd-w: " << pn.forward_weight << ", " + << "rev-w: " << pn.reverse_weight << ", " + << "fwd-o: " << pn.forward_offset << ", " + << "rev-o: " << pn.reverse_offset << ", " + << "geom: " << pn.packed_geometry_id << ", " + << "comp: " << pn.component_id << ", " + << "pos: " << pn.fwd_segment_position << ", " + << "loc: " << pn.location; return out; }