85 *total_num_edges =
sum;
92 return search->second;
104 *total_num = search->second;
114 search->second = num_of_edges;
117 std::string str_err =
"No edge with such name exists.";
128 bool is_loop_closure ,
137 "Specified edge type [%s] already exists but is_new is also specified!",
143 if (is_loop_closure) {
146 std::string str_err =
"Both is_new and is_loop_closure flags are true. Exiting...";
157 std::string str_err =
"No edge with such name exists. Specify is_new parameter if you want to add it";
196 std::cout << str << std::endl;
200 std::stringstream ss_out;
202 ss_out <<
"Summary of Edges: " << std::endl;
203 ss_out << sep << std::endl;
205 ss_out <<
"\tTotal registered edges: " 207 ss_out <<
"\tUnique edges (after removal of multiple edges connecting the same nodes): " 212 ss_out <<
"\t" << it->first <<
" edges: " << it->second << std::endl;
217 *str_out = ss_out.str();
230 const std::map<std::string, double>& name_to_offset_y,
231 const std::map<std::string, int>& name_to_text_index) {
233 "Visualization of data was requested but no CWindowManager pointer was provided");
234 ASSERT_EQUAL_(name_to_offset_y.size(), name_to_text_index.size());
237 name_to_offset_y.begin(); it != name_to_offset_y.end(); ++it) {
244 std::stringstream ss_err;
245 ss_err <<
"Name " <<
name <<
" is not recognized as an Edge type." 251 double offset_y = it->second;
252 int text_index = name_to_text_index.find(
name)->second;
263 const std::map<std::string, double>& name_to_offset_y,
264 const std::map<std::string, int>& name_to_text_index,
265 const double& offset_y_total_edges,
266 const int& text_index_total_edges,
267 const double& offset_y_loop_closures,
268 const int& text_index_loop_closures) {
291 std::stringstream title;
308 double offset_y = it->second;
312 std::stringstream title;
313 title <<
" " <<
name <<
": " << edges_num << std::endl;
323 std::stringstream title;
#define ASSERT_EQUAL_(__A, __B)
bool m_display_loop_closures
int getNumForEdgeType(const std::string &name) const
Return the number of edges for the specified type.
void addEdgeType(const std::string &name)
Explicitly register a new edge type.
#define THROW_EXCEPTION(msg)
mrpt::gui::CDisplayWindow3D * m_win
bool m_display_total_edges
std::map< std::string, double > m_name_to_offset_y
const Scalar * const_iterator
void addTextMessage(const double x, const double y, const std::string &text, const mrpt::utils::TColorf &color=mrpt::utils::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...
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.
CONTAINER::Scalar sum(const CONTAINER &v)
Computes the sum of all the elements.
~CEdgeCounter()
Destructor class.
std::string BASE_IMPEXP format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
int getTotalNumOfEdges() const
Return the total amount of registered edges.
GLsizei const GLchar ** string
void forceRepaint()
Repaints the window. forceRepaint, repaint and updateWindow are all aliases of the same method...
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.
CEdgeCounter()
Constructor class.
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.
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 ...
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 initCEdgeCounter()
Initialization method to be called from the various Constructors.
GLuint const GLchar * name
A RGB color - floats in the range [0,1].
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
#define ASSERTMSG_(f, __ERROR_MSG)
Internal auxiliary classes.
Class acts as a container for storing pointers to mrpt::gui::CDisplayWindow3D, mrpt::graphslam::CWind...