1 #ifndef CMRVISUALIZER_IMPL_H 2 #define CMRVISUALIZER_IMPL_H 6 namespace mrpt {
namespace graphs {
namespace detail {
13 template<
class CPOSE,
class MAPS_IMPLEMENTATION,
class NODE_ANNOTATIONS,
class EDGE_ANNOTATIONS>
19 "CMRVisualizer standard (non-specialized) edition doesn't server any role." 20 "In case you use this visualizer specify TMRSlamNodeAnnotations" 21 "as the 3rd template argument");
24 template<
class CPOSE,
class MAPS_IMPLEMENTATION,
class NODE_ANNOTATIONS,
class EDGE_ANNOTATIONS>
28 template<
class CPOSE,
class MAPS_IMPLEMENTATION,
class NODE_ANNOTATIONS,
class EDGE_ANNOTATIONS>
33 template<
class CPOSE,
class MAPS_IMPLEMENTATION,
class NODE_ANNOTATIONS,
class EDGE_ANNOTATIONS>
46 template<
class CPOSE,
class MAPS_IMPLEMENTATION,
class EDGE_ANNOTATIONS>
52 template<
class CPOSE,
class MAPS_IMPLEMENTATION,
class EDGE_ANNOTATIONS>
57 template<
class CPOSE,
class MAPS_IMPLEMENTATION,
class EDGE_ANNOTATIONS>
68 "nodes_point_size", 0.);
76 map<string, CPointCloudPtr> strid_to_cloud;
78 map<string, TColorf> strid_to_color;
92 const string& curr_strid = curr_node.agent_ID_str;
95 if (strid_to_cloud.find(curr_strid) != strid_to_cloud.end()) {
98 ASSERTMSG_(strid_to_color.find(curr_strid) != strid_to_color.end(),
99 "Agent string ID not found in colors map even though its CPointCloud exists.");
104 strid_to_cloud.insert(make_pair(
105 curr_strid, CPointCloud::Create()));
107 strid_to_color.insert(make_pair(
110 CPointCloudPtr& curr_cloud = strid_to_cloud.at(curr_strid);
111 curr_cloud->setColor(strid_to_color.at(curr_strid));
112 curr_cloud->setPointSize(nodes_point_size);
113 curr_cloud->enablePointSmooth();
121 CPointCloudPtr& curr_cloud = strid_to_cloud.at(curr_strid);
122 curr_cloud->insertPoint(
p.x(),
p.y(),
p.z());
128 it = strid_to_cloud.begin();
129 it != strid_to_cloud.end();
132 object->insert(it->second);
137 template<
class CPOSE,
class MAPS_IMPLEMENTATION,
class EDGE_ANNOTATIONS>
145 ASSERTMSG_(viz_params,
"Pointer to viz_params was not provided.");
146 typedef map<pair<string, bool>, CSetOfLinesPtr> PairToSetOfLines_t;
152 PairToSetOfLines_t id_to_set_of_lines;
154 map<string, TColorf> strid_to_color;
161 "interconnecting_edge_width", 4.);
169 const TNodeID& start_node = edge_it->first.first;
170 const TNodeID& end_node = edge_it->first.second;
188 std::string curr_end_strid = n_it2->second.agent_ID_str;
189 bool is_interconnecting_edge = n_it1->second.agent_ID_str != n_it2->second.agent_ID_str;
191 pair<string, bool> curr_pair = make_pair(curr_end_strid, is_interconnecting_edge);
194 if (id_to_set_of_lines.find(curr_pair) != id_to_set_of_lines.end()) {
199 id_to_set_of_lines.insert(make_pair(
200 curr_pair, CSetOfLines::Create()));
204 if (strid_to_color.find(curr_end_strid) == strid_to_color.end()) {
205 strid_to_color.insert(make_pair(
211 CSetOfLinesPtr& curr_set_of_lines =
212 id_to_set_of_lines.at(curr_pair);
215 curr_set_of_lines->setColor(strid_to_color.at(curr_end_strid));
219 is_interconnecting_edge? interconnecting_edge_width : edge_width;
220 curr_set_of_lines->setLineWidth(curr_width);
227 CSetOfLinesPtr& curr_set_of_lines = id_to_set_of_lines.at(curr_pair);
230 curr_set_of_lines->appendLine(
238 it = id_to_set_of_lines.begin();
239 it != id_to_set_of_lines.end();
242 object->insert(it->second);
double x() const
Common members of all points & poses classes.
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
#define THROW_EXCEPTION(msg)
Abstract graph and tree data structures, plus generic graph algorithms.
void drawEdges(mrpt::opengl::CSetOfObjectsPtr &object, const mrpt::utils::TParametersDouble *viz_params=NULL) const
const Scalar * const_iterator
Base class for C*Visualizer classes.
A directed graph of pose constraints, with edges being the relative poses between pairs of nodes iden...
uint64_t TNodeID
The type for node IDs in graphs of different types.
Manage R, G, B color triads and ask class instance of the next unique RGB combination.
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...
mrpt::utils::TColorf getNextTColorf()
Get the next RGB triad in TColorf form.
GLsizei const GLchar ** string
void drawNodePoints(mrpt::opengl::CSetOfObjectsPtr &object, const mrpt::utils::TParametersDouble *viz_params=NULL) const
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
T getWithDefaultVal(const std::string &s, const T &defaultVal) const
A const version of the [] operator and with a default value in case the parameter is not set (for usa...
The namespace for 3D scene representation and rendering.
global_poses_t nodes
The nodes (vertices) of the graph, with their estimated "global" (with respect to root) position...
#define ASSERTMSG_(f, __ERROR_MSG)
edges_map_t::const_iterator const_iterator