1 #ifndef GL_ENTITY_SELECTOR_HPP
2 #define GL_ENTITY_SELECTOR_HPP
4 #include "../gl_base.hpp"
5 #include "../structures/Color.hpp"
9 namespace gl::interface
20 template <
class GRAPH>
25 if (graph.hasEdge(src,dest))
27 return {
true,trueColor};
30 return {
false,falseColor};
48 if (!path.first)
return {
false,falseColor};
51 if (path.second[i] == src && path.second[i+1] == dest)
52 return {
true,trueColor};
54 return {
false,falseColor};
68 template <
class SHORTEST_PATH_ALGORITHM>
71 return [&spa, pathSource, pathDest, trueColor, falseColor](
const gl::index_type src,
const gl::index_type dest) -> std::pair<bool,gl::Color> {
72 auto path = spa.getPath(pathSource,pathDest);
74 return selEdge(src,dest);
87 template <
class SHORTEST_PATH_ALGORITHM>
92 auto spt = spa.getSPT(treeSource);
94 return selEdge(src,dest);
106 template <
class PATH>
110 return [path, trueColor, falseColor](
const gl::index_type node) -> std::pair<bool,gl::Color> {
112 if (!path.first)
return {
false,falseColor};
115 if (path.second[i] == node)
116 return {
true,trueColor};
118 return {
false,falseColor};
132 template <
class SHORTEST_PATH_ALGORITHM>
136 return [&spa, pathSource, pathDest, trueColor, falseColor](
const gl::index_type node) -> std::pair<bool,gl::Color> {
137 auto path = spa.getPath(pathSource,pathDest);
139 return selEdge(node);
152 template <
class SHORTEST_PATH_ALGORITHM>
156 return [&spa, treeSource, trueColor, falseColor](
const gl::index_type node) -> std::pair<bool,gl::Color> {
157 if (!spa.pathLength(treeSource,node).isInfinite())
159 return {
true,trueColor};
163 return {
false,falseColor};
170 #endif // GL_ENTITY_SELECTOR_HPP
Stores an RGBA Color.
Definition: Color.hpp:21
std::function< std::pair< bool, gl::Color >const gl::index_type src, const gl::index_type dest)> getEdgeSelectorFromPath(const PATH &path, const gl::Color &trueColor=gl::Color("red"), const gl::Color &falseColor=gl::Color("black"))
Provides a Selector Object to color the edges in a given Path.
Definition: EntitySelector.hpp:43
std::size_t index_type
Definition: gl_base.hpp:18
std::function< std::pair< bool, gl::Color >const gl::index_type node)> getNodeSelectorFromShortestPathTree(SHORTEST_PATH_ALGORITHM &spa, const gl::index_type treeSource, const gl::Color &trueColor=gl::Color("red"), const gl::Color &falseColor=gl::Color("white"))
Provides a Selector Object to color the nodes in a Shortest Path Tree.
Definition: EntitySelector.hpp:153
std::function< std::pair< bool, gl::Color >const gl::index_type src, const gl::index_type dest)> getEdgeSelectorFromShortestPath(SHORTEST_PATH_ALGORITHM &spa, const gl::index_type pathSource, const gl::index_type pathDest, const gl::Color &trueColor=gl::Color("red"), const gl::Color &falseColor=gl::Color("black"))
Provides a Selector Object to color the edges in a Shortest Path.
Definition: EntitySelector.hpp:69
std::function< std::pair< bool, gl::Color >const gl::index_type node)> getNodeSelectorFromPath(const PATH &path, const gl::Color &trueColor=gl::Color("red"), const gl::Color &falseColor=gl::Color("white"))
Provides a Selector Object to color the nodes in a given Path.
Definition: EntitySelector.hpp:107
std::function< std::pair< bool, gl::Color >const gl::index_type src, const gl::index_type dest)> getEdgeSelectorFromShortestPathTree(SHORTEST_PATH_ALGORITHM &spa, const gl::index_type treeSource, const gl::Color &trueColor=gl::Color("red"), const gl::Color &falseColor=gl::Color("black"))
Provides a Selector Object to color the edges in a Shortest Path Tree.
Definition: EntitySelector.hpp:88
std::function< std::pair< bool, gl::Color >const gl::index_type src, const gl::index_type dest)> getEdgeSelectorFromGraph(const GRAPH &graph, const gl::Color &trueColor=gl::Color("red"), const gl::Color &falseColor=gl::Color("black"))
Provides a Selector Object to color the edges in a given Graph.
Definition: EntitySelector.hpp:21
std::function< std::pair< bool, gl::Color >const gl::index_type node)> getNodeSelectorFromShortestPath(SHORTEST_PATH_ALGORITHM &spa, const gl::index_type pathSource, const gl::index_type pathDest, const gl::Color &trueColor=gl::Color("red"), const gl::Color &falseColor=gl::Color("white"))
Provides a Selector Object to color the nodes in a Shortest Path.
Definition: EntitySelector.hpp:133