Skip to content

Commit aa8be02

Browse files
committed
Implemented contains() function for edge
Signed-off-by: tanjunkiat <[email protected]>
1 parent 40e023c commit aa8be02

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

rmf_traffic_editor/gui/edge.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -202,3 +202,8 @@ double Edge::get_width() const
202202
return -1.0;// shouldn't get here
203203
return it->second.value_double;
204204
}
205+
206+
bool Edge::contains(const int idx) const
207+
{
208+
return start_idx == idx || end_idx == idx;
209+
}

rmf_traffic_editor/gui/edge.h

+1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ class Edge
7171
int get_graph_idx() const;
7272

7373
double get_width() const;
74+
bool contains(const int idx) const;
7475
};
7576

7677
#endif

rmf_traffic_editor/gui/level.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -508,8 +508,7 @@ bool Level::delete_used_entities(int selected_vertex_idx)
508508
edges.end(),
509509
[selected_vertex_idx](const Edge& edge)
510510
{
511-
return edge.start_idx == selected_vertex_idx ||
512-
edge.end_idx == selected_vertex_idx;
511+
return edge.contains(selected_vertex_idx);
513512
}),
514513
edges.end());
515514

0 commit comments

Comments
 (0)