25 #include <SimoxUtility/color/cmaps.h>
27 #include <RobotAPI/libraries/armem/aron/MemoryID.aron.generated.h>
40 #include <SemanticObjectRelations/Shapes/Shape.h>
52 int shapeIDCounter = 0;
54 graph.attrib().initialMemoryID =
memoryID;
57 std::map<armarx::armem::MemoryID, int> shapeIDs;
58 std::vector<std::tuple<int, int, std::pair<std::string, bool>>> edges;
59 std::vector<armarx::armem::MemoryID> currentLevel{
memoryID};
60 std::vector<armarx::armem::MemoryID> nextLevel;
63 shapeIDs[
memoryID] = shapeIDCounter++;
65 while (!currentLevel.empty())
72 graph.addVertex(semrel::ShapeID{shapeIDs[vertID]}, vert);
82 ARMARX_WARNING <<
"Could not extract Aron data and type from memory object.";
85 auto [aronData, aronType] = objectAndType.value();
87 auto ids = getMemoryIDs(aronData, aronType);
88 for (
const auto& ref : ids)
90 if (!ref.second.hasMemoryName())
95 nowhere.
depth = depth + 1;
96 int nowhereID = shapeIDCounter++;
97 graph.addVertex(semrel::ShapeID{nowhereID}, nowhere);
99 shapeIDs[vertID], nowhereID, std::make_pair(ref.first,
true));
103 if (shapeIDs.find(ref.second) == shapeIDs.end())
105 shapeIDs[ref.second] = shapeIDCounter++;
106 nextLevel.push_back(ref.second);
109 shapeIDs[vertID], shapeIDs[ref.second], std::make_pair(ref.first,
false));
112 currentLevel = std::move(nextLevel);
117 for (
const auto& [vert1, vert2, edgeProps] : edges)
122 graph.addEdge(semrel::ShapeID{vert1}, semrel::ShapeID{vert2}, memEdge);
129 for (
auto vertex : graph.vertices())
131 maxDepth =
std::max(maxDepth, vertex.attrib().depth);
134 simox::ColorMap cmap = simox::color::cmaps::GnBu();
135 cmap.set_vlimits(0, maxDepth + 1);
136 for (
auto vertex : graph.vertices())
146 std::map<std::string, armarx::armem::MemoryID>