20 class CPOSE,
class MAPS_IMPLEMENTATION,
class NODE_ANNOTATIONS,
21 class EDGE_ANNOTATIONS>
27 "CMRVisualizer standard (non-specialized) edition doesn't server any " 29 "In case you use this visualizer specify TMRSlamNodeAnnotations" 30 "as the 3rd template argument");
34 class CPOSE,
class MAPS_IMPLEMENTATION,
class NODE_ANNOTATIONS,
35 class EDGE_ANNOTATIONS>
40 class CPOSE,
class MAPS_IMPLEMENTATION,
class NODE_ANNOTATIONS,
41 class EDGE_ANNOTATIONS>
43 CPOSE, MAPS_IMPLEMENTATION, NODE_ANNOTATIONS, EDGE_ANNOTATIONS>::
51 class CPOSE,
class MAPS_IMPLEMENTATION,
class NODE_ANNOTATIONS,
52 class EDGE_ANNOTATIONS>
54 CPOSE, MAPS_IMPLEMENTATION, NODE_ANNOTATIONS, EDGE_ANNOTATIONS>::
68 template <
class CPOSE,
class MAPS_IMPLEMENTATION,
class EDGE_ANNOTATIONS>
76 template <
class CPOSE,
class MAPS_IMPLEMENTATION,
class EDGE_ANNOTATIONS>
79 EDGE_ANNOTATIONS>::~CMRVisualizer() =
default;
81 template <
class CPOSE,
class MAPS_IMPLEMENTATION,
class EDGE_ANNOTATIONS>
93 const double nodes_point_size =
102 map<string, CPointCloud::Ptr> strid_to_cloud;
104 map<string, TColorf> strid_to_color;
109 this->m_graph.nodes.begin();
110 n_it != this->m_graph.nodes.end(); ++n_it)
118 const string& curr_strid = curr_node.agent_ID_str;
121 if (strid_to_cloud.find(curr_strid) != strid_to_cloud.end())
126 strid_to_color.find(curr_strid) != strid_to_color.end(),
127 "Agent string ID not found in colors map even though its " 128 "CPointCloud exists.");
133 strid_to_cloud.insert(
134 make_pair(curr_strid, std::make_shared<CPointCloud>()));
136 strid_to_color.insert(
140 curr_cloud->setColor(strid_to_color.at(curr_strid));
141 curr_cloud->setPointSize(nodes_point_size);
151 curr_cloud->insertPoint(p.
x(), p.
y(), p.z());
156 for (
auto it = strid_to_cloud.begin(); it != strid_to_cloud.end(); ++it)
158 object->insert(it->second);
163 template <
class CPOSE,
class MAPS_IMPLEMENTATION,
class EDGE_ANNOTATIONS>
173 ASSERTMSG_(viz_params,
"Pointer to viz_params was not provided.");
180 PairToSetOfLines_t id_to_set_of_lines;
182 map<string, TColorf> strid_to_color;
188 const double interconnecting_edge_width =
193 edge_it != this->m_graph.end(); ++edge_it)
195 const TNodeID& start_node = edge_it->first.first;
196 const TNodeID& end_node = edge_it->first.second;
200 this->m_graph.nodes.find(start_node);
202 this->m_graph.nodes.find(end_node);
205 if (n_it1 == this->m_graph.nodes.end() ||
206 n_it2 == this->m_graph.nodes.end())
217 std::string curr_end_strid = n_it2->second.agent_ID_str;
218 bool is_interconnecting_edge =
219 n_it1->second.agent_ID_str != n_it2->second.agent_ID_str;
221 pair<string, bool> curr_pair =
222 make_pair(curr_end_strid, is_interconnecting_edge);
225 if (id_to_set_of_lines.find(curr_pair) != id_to_set_of_lines.end())
232 id_to_set_of_lines.insert(
233 make_pair(curr_pair, std::make_shared<CSetOfLines>()));
237 if (strid_to_color.find(curr_end_strid) == strid_to_color.end())
239 strid_to_color.insert(make_pair(
246 id_to_set_of_lines.at(curr_pair);
249 curr_set_of_lines->setColor(strid_to_color.at(curr_end_strid));
252 double curr_width = is_interconnecting_edge
253 ? interconnecting_edge_width
255 curr_set_of_lines->setLineWidth(curr_width);
265 curr_set_of_lines->appendLine(
272 for (
auto it = id_to_set_of_lines.begin(); it != id_to_set_of_lines.end();
275 object->insert(it->second);
~CMRVisualizer() override
#define THROW_EXCEPTION(msg)
Abstract graph and tree data structures, plus generic graph algorithms.
Base class for C*Visualizer classes.
mrpt::img::TColorf getNextTColorf()
Get the next RGB triad in TColorf form.
A directed graph of pose constraints, with edges being the relative poses between pairs of nodes iden...
Internal functions for MRPT.
CMRVisualizer(const GRAPH_T &graph_in)
The type of each global pose in nodes: an extension of the constraint_no_pdf_t pose with any optional...
#define ASSERTMSG_(f, __ERROR_MSG)
Defines an assertion mechanism.
double x() const
Common members of all points & poses classes.
RET getWithDefaultVal(const std::string &s, const RET &defaultVal) const
A const version of the [] operator and with a default value in case the parameter is not set (for usa...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
The namespace for 3D scene representation and rendering.
typename edges_map_t::const_iterator const_iterator
uint64_t TNodeID
A generic numeric type for unique IDs of nodes or entities.
Manage R, G, B color triads and ask class instance of the next unique RGB combination.
Struct to be used as the NODE_ANNOTATIONS template argument in CNetworkOfPoses class instances for us...
Wrapper class that provides visualization of a network of poses that have been registered by many gra...