58 *total_num_edges =
sum;
66 return search->second;
79 *total_num = search->second;
92 search->second = num_of_edges;
96 std::string str_err =
"No edge with such name exists.";
108 const std::string& name,
bool is_loop_closure ,
120 "Specified edge type [%s] already exists but is_new is also " 132 std::string str_err =
133 "Both is_new and is_loop_closure flags are true. " 148 std::string str_err =
149 "No edge with such name exists. Specify is_new parameter if " 150 "you want to add it";
170 "Specified edge type [%s] already exists", name.c_str()));
194 std::cout << str << std::endl;
199 std::stringstream ss_out;
200 std::string sep(80,
'#');
201 ss_out <<
"Summary of Edges: " << std::endl;
202 ss_out << sep << std::endl;
206 ss_out <<
"\tUnique edges (after removal of multiple edges connecting the " 212 ss_out <<
"\t" << it.first <<
" edges: " << it.second << std::endl;
218 *str_out = ss_out.str();
232 const std::map<std::string, double>& name_to_offset_y,
233 const std::map<std::string, int>& name_to_text_index)
237 "Visualization of data was requested but no CWindowManager pointer was " 241 for (
const auto& it : name_to_offset_y)
243 std::string name = it.first;
249 std::stringstream ss_err;
250 ss_err <<
"Name " << name <<
" is not recognized as an Edge type." 256 double offset_y = it.second;
257 int text_index = name_to_text_index.find(name)->second;
267 const std::map<std::string, double>& name_to_offset_y,
268 const std::map<std::string, int>& name_to_text_index,
269 double offset_y_total_edges,
int text_index_total_edges,
270 double offset_y_loop_closures,
int text_index_loop_closures)
293 std::stringstream title;
309 std::string name = it.first;
310 double offset_y = it.second;
314 std::stringstream ss;
315 ss <<
" " << name <<
": " << edges_num << std::endl;
324 std::stringstream ss;
bool m_display_loop_closures
int getNumForEdgeType(const std::string &name) const
Return the number of edges for the specified type.
#define THROW_EXCEPTION(msg)
std::string std::string format(std::string_view fmt, ARGS &&... args)
void addEdgeType(const std::string &name)
Explicitly register a new edge type.
mrpt::gui::CDisplayWindow3D * m_win
bool m_display_total_edges
std::map< std::string, double > m_name_to_offset_y
mrpt::graphslam::CWindowManager * m_win_manager
void setLoopClosureEdgesManually(int num_loop_closures)
Method for manually setting the number of loop closures registered so far.
int getLoopClosureEdges() const
Returns the edges that form loop closures in the current graph.
int m_offset_y_loop_closures
void setRemovedEdges(int removed_edges)
State how many of the existing edges have been removed.
void setWindowManagerPtr(mrpt::graphslam::CWindowManager *win_manager)
Provide the instance with a CWindowManager.
mrpt::gui::CDisplayWindow3D * win
CDisplayWindow instance.
#define ASSERTDEB_EQUAL_(__A, __B)
CONTAINER::Scalar sum(const CONTAINER &v)
Computes the sum of all the elements.
int getTotalNumOfEdges() const
Return the total amount of registered edges.
void forceRepaint()
Repaints the window.
#define ASSERTDEBMSG_(f, __ERROR_MSG)
void clearAllEdges()
Reset the state of the CEdgeCounter instance.
std::map< std::string, int > m_name_to_edges_num
Map edge name <=> num of edges.
int m_text_index_loop_closures
std::map< std::string, int > m_name_to_text_index
void dumpToConsole() const
Dump a report of the registered, so far, edges to the console.
#define ASSERTDEB_(f)
Defines an assertion mechanism - only when compiled in debug.
int m_text_index_total_edges
void setTextMessageParams(const std::map< std::string, double > &name_to_offset_y, const std::map< std::string, int > &name_to_text_index)
Add the textMessage parameters to the object All the names in the given std::maps have to be already ...
An RGBA color - floats in the range [0,1].
void setEdgesManually(const std::string &name, int num_of_edges)
Set number of a specific edge type manually.
int m_offset_y_total_edges
void addTextMessage(const double x, const double y, const std::string &text, const mrpt::img::TColorf &color=mrpt::img::TColorf(1.0, 1.0, 1.0), const size_t unique_index=0)
Wrapper around the CDisplayWindow3D::addTextMessage method, so that the user does not have to specify...
void updateTextMessages() const
Update the given CDisplayWindow3D with the edges registered so far.
std::string getAsString() const
Return a detailed report of the registered, so far, edges in a string representation.
void addEdge(const std::string &name, bool is_loop_closure=false, bool is_new=false)
Increment the number of edges for the specified type.
bool m_has_read_textmessage_params
Internal auxiliary classes.
Class acts as a container for storing pointers to mrpt::gui::CDisplayWindow3D, mrpt::graphslam::CWind...