MRPT
2.0.4
|
Generic class for tracking the total number of edges for different tpes of edges and for storing visualization-related information for each type.
Definition at line 27 of file CEdgeCounter.h.
#include <mrpt/graphslam/misc/CEdgeCounter.h>
Public Types | |
using | iterator = std::map< std::string, int >::iterator |
using | const_iterator = std::map< std::string, int >::const_iterator |
Public Member Functions | |
CEdgeCounter () | |
~CEdgeCounter ()=default | |
void | setWindowManagerPtr (mrpt::graphslam::CWindowManager *win_manager) |
Provide the instance with a CWindowManager. More... | |
void | setRemovedEdges (int removed_edges) |
State how many of the existing edges have been removed. More... | |
void | setLoopClosureEdgesManually (int num_loop_closures) |
Method for manually setting the number of loop closures registered so far. More... | |
int | getLoopClosureEdges () const |
Returns the edges that form loop closures in the current graph. More... | |
int | getTotalNumOfEdges () const |
Return the total amount of registered edges. More... | |
void | getTotalNumOfEdges (int *total_num_edges) const |
Return the total amount of registered edges. More... | |
int | getNumForEdgeType (const std::string &name) const |
Return the number of edges for the specified type. More... | |
void | getNumForEdgeType (const std::string &name, int *total_num) |
Return the number of edges for the specified type. More... | |
void | setEdgesManually (const std::string &name, int num_of_edges) |
Set number of a specific edge type manually. More... | |
void | addEdge (const std::string &name, bool is_loop_closure=false, bool is_new=false) |
Increment the number of edges for the specified type. More... | |
void | addEdgeType (const std::string &name) |
Explicitly register a new edge type. More... | |
void | clearAllEdges () |
Reset the state of the CEdgeCounter instance. More... | |
void | dumpToConsole () const |
Dump a report of the registered, so far, edges to the console. More... | |
void | getAsString (std::string *str_out) const |
Fill the provided string with a detailed report of the registered, so far, edges. More... | |
std::string | getAsString () const |
Return a detailed report of the registered, so far, edges in a string representation. More... | |
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 specified and added in the object via addEdge with is_new=true or addEdgeType. More... | |
void | setTextMessageParams (const std::map< std::string, double > &name_to_offset_y, const std::map< std::string, int > &name_to_text_index, double offset_y_total_edges, int text_index_total_edges, double offset_y_loop_closures, int text_index_loop_closures) |
Handle the extra visualization parameters for the total number of edges and for loop closures and then passes execution to the other setTextMessageParams function. More... | |
iterator | begin () |
Instance Iterators. More... | |
const_iterator | cbegin () const |
iterator | end () |
const_iterator | cend () const |
Private Member Functions | |
void | updateTextMessages () const |
Update the given CDisplayWindow3D with the edges registered so far. More... | |
Private Attributes | |
mrpt::gui::CDisplayWindow3D * | m_win = nullptr |
mrpt::graphslam::CWindowManager * | m_win_manager = nullptr |
std::map< std::string, int > | m_name_to_edges_num |
Map edge name <=> num of edges. More... | |
int | m_num_loop_closures = 0 |
int | m_unique_edges = 0 |
std::map< std::string, double > | m_name_to_offset_y |
std::map< std::string, int > | m_name_to_text_index |
bool | m_has_read_textmessage_params |
bool | m_display_total_edges = false |
bool | m_display_loop_closures = false |
int | m_offset_y_total_edges = 0 |
int | m_offset_y_loop_closures = 0 |
int | m_text_index_total_edges = 0 |
int | m_text_index_loop_closures = 0 |
using mrpt::graphslam::detail::CEdgeCounter::const_iterator = std::map<std::string, int>::const_iterator |
Definition at line 31 of file CEdgeCounter.h.
using mrpt::graphslam::detail::CEdgeCounter::iterator = std::map<std::string, int>::iterator |
Definition at line 30 of file CEdgeCounter.h.
CEdgeCounter::CEdgeCounter | ( | ) |
Definition at line 16 of file CEdgeCounter.cpp.
References clearAllEdges().
|
default |
void CEdgeCounter::addEdge | ( | const std::string & | name, |
bool | is_loop_closure = false , |
||
bool | is_new = false |
||
) |
Increment the number of edges for the specified type.
std::exception | If edge exists and is_new is True |
Definition at line 107 of file CEdgeCounter.cpp.
References mrpt::format(), m_has_read_textmessage_params, m_name_to_edges_num, m_num_loop_closures, m_win_manager, THROW_EXCEPTION, and updateTextMessages().
void CEdgeCounter::addEdgeType | ( | const std::string & | name | ) |
Explicitly register a new edge type.
Definition at line 163 of file CEdgeCounter.cpp.
References mrpt::format(), m_name_to_edges_num, and THROW_EXCEPTION.
|
inline |
|
inline |
Definition at line 135 of file CEdgeCounter.h.
References m_name_to_edges_num.
|
inline |
Definition at line 140 of file CEdgeCounter.h.
References m_name_to_edges_num.
void CEdgeCounter::clearAllEdges | ( | ) |
Reset the state of the CEdgeCounter instance.
Definition at line 178 of file CEdgeCounter.cpp.
References m_display_loop_closures, m_display_total_edges, m_has_read_textmessage_params, m_name_to_edges_num, m_name_to_offset_y, m_name_to_text_index, and m_num_loop_closures.
Referenced by CEdgeCounter().
void CEdgeCounter::dumpToConsole | ( | ) | const |
Dump a report of the registered, so far, edges to the console.
Definition at line 191 of file CEdgeCounter.cpp.
References getAsString().
|
inline |
Definition at line 139 of file CEdgeCounter.h.
References m_name_to_edges_num.
void CEdgeCounter::getAsString | ( | std::string * | str_out | ) | const |
Fill the provided string with a detailed report of the registered, so far, edges.
Definition at line 197 of file CEdgeCounter.cpp.
References getLoopClosureEdges(), getTotalNumOfEdges(), m_name_to_edges_num, and m_unique_edges.
std::string CEdgeCounter::getAsString | ( | ) | const |
Return a detailed report of the registered, so far, edges in a string representation.
Definition at line 221 of file CEdgeCounter.cpp.
Referenced by dumpToConsole().
int CEdgeCounter::getLoopClosureEdges | ( | ) | const |
Returns the edges that form loop closures in the current graph.
Definition at line 40 of file CEdgeCounter.cpp.
References m_num_loop_closures.
Referenced by getAsString().
int CEdgeCounter::getNumForEdgeType | ( | const std::string & | name | ) | const |
Return the number of edges for the specified type.
std::exception | If edge is not found |
Definition at line 61 of file CEdgeCounter.cpp.
References m_name_to_edges_num, and THROW_EXCEPTION.
void CEdgeCounter::getNumForEdgeType | ( | const std::string & | name, |
int * | total_num | ||
) |
Return the number of edges for the specified type.
std::exception | If edge is not found |
Definition at line 74 of file CEdgeCounter.cpp.
References m_name_to_edges_num, and THROW_EXCEPTION.
int CEdgeCounter::getTotalNumOfEdges | ( | ) | const |
Return the total amount of registered edges.
Definition at line 41 of file CEdgeCounter.cpp.
References mrpt::math::sum().
Referenced by getAsString(), setRemovedEdges(), and updateTextMessages().
void CEdgeCounter::getTotalNumOfEdges | ( | int * | total_num_edges | ) | const |
Return the total amount of registered edges.
Definition at line 49 of file CEdgeCounter.cpp.
References ASSERTDEB_, m_name_to_edges_num, and mrpt::math::sum().
void CEdgeCounter::setEdgesManually | ( | const std::string & | name, |
int | num_of_edges | ||
) |
Set number of a specific edge type manually.
Handy for not having to call addEdge multiple times in a row.
Definition at line 87 of file CEdgeCounter.cpp.
References m_has_read_textmessage_params, m_name_to_edges_num, m_win_manager, THROW_EXCEPTION, and updateTextMessages().
void CEdgeCounter::setLoopClosureEdgesManually | ( | int | num_loop_closures | ) |
Method for manually setting the number of loop closures registered so far.
Definition at line 35 of file CEdgeCounter.cpp.
References m_num_loop_closures.
void CEdgeCounter::setRemovedEdges | ( | int | removed_edges | ) |
State how many of the existing edges have been removed.
Method is to be called after CNetworkOfPoses::collapseDuplicatedEdges method has been executed.
Definition at line 30 of file CEdgeCounter.cpp.
References getTotalNumOfEdges(), and m_unique_edges.
void CEdgeCounter::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 specified and added in the object via addEdge with is_new=true or addEdgeType.
std::exception | If a name in the provided std::map doesn't already exist |
Definition at line 231 of file CEdgeCounter.cpp.
References ASSERTDEB_EQUAL_, ASSERTDEBMSG_, m_has_read_textmessage_params, m_name_to_edges_num, m_name_to_offset_y, m_name_to_text_index, m_win_manager, and THROW_EXCEPTION.
Referenced by setTextMessageParams().
void CEdgeCounter::setTextMessageParams | ( | const std::map< std::string, double > & | name_to_offset_y, |
const std::map< std::string, int > & | name_to_text_index, | ||
double | offset_y_total_edges, | ||
int | text_index_total_edges, | ||
double | offset_y_loop_closures, | ||
int | text_index_loop_closures | ||
) |
Handle the extra visualization parameters for the total number of edges and for loop closures and then passes execution to the other setTextMessageParams function.
Definition at line 266 of file CEdgeCounter.cpp.
References m_display_loop_closures, m_display_total_edges, m_offset_y_loop_closures, m_offset_y_total_edges, m_text_index_loop_closures, m_text_index_total_edges, and setTextMessageParams().
void CEdgeCounter::setWindowManagerPtr | ( | mrpt::graphslam::CWindowManager * | win_manager | ) |
Provide the instance with a CWindowManager.
Definition at line 17 of file CEdgeCounter.cpp.
References ASSERTDEB_, m_win, m_win_manager, MRPT_END, MRPT_START, and mrpt::graphslam::CWindowManager::win.
|
private |
Update the given CDisplayWindow3D with the edges registered so far.
Definition at line 286 of file CEdgeCounter.cpp.
References mrpt::graphslam::CWindowManager::addTextMessage(), ASSERTDEB_, ASSERTDEB_EQUAL_, mrpt::gui::CDisplayWindow3D::forceRepaint(), getTotalNumOfEdges(), m_display_loop_closures, m_display_total_edges, m_has_read_textmessage_params, m_name_to_edges_num, m_name_to_offset_y, m_name_to_text_index, m_num_loop_closures, m_offset_y_loop_closures, m_offset_y_total_edges, m_text_index_loop_closures, m_text_index_total_edges, m_win, and m_win_manager.
Referenced by addEdge(), and setEdgesManually().
|
private |
Definition at line 167 of file CEdgeCounter.h.
Referenced by clearAllEdges(), setTextMessageParams(), and updateTextMessages().
|
private |
Definition at line 166 of file CEdgeCounter.h.
Referenced by clearAllEdges(), setTextMessageParams(), and updateTextMessages().
|
private |
Definition at line 163 of file CEdgeCounter.h.
Referenced by addEdge(), clearAllEdges(), setEdgesManually(), setTextMessageParams(), and updateTextMessages().
|
private |
Map edge name <=> num of edges.
Tracking number of edges
Definition at line 155 of file CEdgeCounter.h.
Referenced by addEdge(), addEdgeType(), begin(), cbegin(), cend(), clearAllEdges(), end(), getAsString(), getNumForEdgeType(), getTotalNumOfEdges(), setEdgesManually(), setTextMessageParams(), and updateTextMessages().
|
private |
Definition at line 160 of file CEdgeCounter.h.
Referenced by clearAllEdges(), setTextMessageParams(), and updateTextMessages().
|
private |
Definition at line 161 of file CEdgeCounter.h.
Referenced by clearAllEdges(), setTextMessageParams(), and updateTextMessages().
|
private |
Definition at line 156 of file CEdgeCounter.h.
Referenced by addEdge(), clearAllEdges(), getLoopClosureEdges(), setLoopClosureEdgesManually(), and updateTextMessages().
|
private |
Definition at line 169 of file CEdgeCounter.h.
Referenced by setTextMessageParams(), and updateTextMessages().
|
private |
Definition at line 168 of file CEdgeCounter.h.
Referenced by setTextMessageParams(), and updateTextMessages().
|
private |
Definition at line 171 of file CEdgeCounter.h.
Referenced by setTextMessageParams(), and updateTextMessages().
|
private |
Definition at line 170 of file CEdgeCounter.h.
Referenced by setTextMessageParams(), and updateTextMessages().
|
private |
Definition at line 157 of file CEdgeCounter.h.
Referenced by getAsString(), and setRemovedEdges().
|
private |
Definition at line 148 of file CEdgeCounter.h.
Referenced by setWindowManagerPtr(), and updateTextMessages().
|
private |
Definition at line 149 of file CEdgeCounter.h.
Referenced by addEdge(), setEdgesManually(), setTextMessageParams(), setWindowManagerPtr(), and updateTextMessages().
Page generated by Doxygen 1.8.14 for MRPT 2.0.4 Git: 33de1d0ad Sat Jun 20 11:02:42 2020 +0200 at sáb jun 20 17:35:17 CEST 2020 |