![]() |
smgl 0.11.0
Structured Metadata Engine and Graph Objects Library
|
Class defining a Graph's style when writing to a Dot file. More...
#include <smgl/Graphviz.hpp>
Public Member Functions | |
| GraphStyle () | |
| Default constructor. | |
Default Node Style | |
The properties defined in the default node style are applied to all nodes. | |
| void | setDefaultStyle (const NodeStyle &style) |
| Set the default node style. | |
| auto | defaultStyle () -> NodeStyle & |
| Access the default node style. | |
| auto | defaultStyle () const -> const NodeStyle & |
| Access the default node style. | |
Class-specific Node Styles | |
The properties defined in a class-specific node style are applied to all nodes of a specific class and take precedence over properties defined in the default node style. | |
| void | setClassStyle (const std::string &name, const NodeStyle &style) |
| Set a class-specific node style. | |
| template<class NodeT > | |
| void | setClassStyle (const NodeStyle &style) |
| Set a class-specific node style. | |
| auto | hasClassStyle (const std::string &name) const -> bool |
| Check if a class of nodes has an associated style. | |
| template<class NodeT > | |
| auto | hasClassStyle () const -> bool |
| Check if a class of nodes has an associated style. | |
| void | eraseClassStyle (const std::string &name) |
| Erase the style associated with a class of nodes. | |
| template<class NodeT > | |
| void | eraseClassStyle () const |
| Erase the style associated with a class of nodes. | |
| auto | classStyle (const std::string &name) -> NodeStyle & |
| Access the style for a class of nodes. | |
| template<class NodeT > | |
| auto | classStyle () -> NodeStyle & |
| Access the style for a class of nodes. | |
| auto | classStyle (const std::string &name) const -> const NodeStyle & |
| Access the style for a class of nodes. | |
| template<class NodeT > | |
| auto | classStyle () const -> const NodeStyle & |
| Access the style for a class of nodes. | |
Instance-specific Node Styles | |
The properties defined in an instance-specific node style are only applied to a specific node instance as determined by its smgl::Uuid. These properties take precedence over the properties defined in the default and class-specific node styles. | |
| void | setInstanceStyle (const Node::Pointer &node, const NodeStyle &style) |
| Set a instance-specific node style. | |
| void | setInstanceStyle (const Node *node, const NodeStyle &style) |
| Set a instance-specific node style. | |
| auto | hasInstanceStyle (const Node::Pointer &node) const -> bool |
| Check if a node has an associated instance style. | |
| auto | hasInstanceStyle (const Node *node) const -> bool |
| Check if a node has an associated instance style. | |
| void | eraseInstanceStyle (const Node::Pointer &node) |
| Erase the style associated with a node instance. | |
| void | eraseInstanceStyle (const Node *node) |
| Erase the style associated with a node instance. | |
| auto | instanceStyle (const Node::Pointer &node) -> NodeStyle & |
| Access the style for a node instance. | |
| auto | instanceStyle (const Node::Pointer &node) const -> const NodeStyle & |
| Access the style for a node instance. | |
| auto | instanceStyle (const Node *node) -> NodeStyle & |
| Access the style for a node instance. | |
| auto | instanceStyle (const Node *node) const -> const NodeStyle & |
| Access the style for a node instance. | |
Evaluated Node Style | |
The evaluated node style represents the final style for a specific node after all property precedence relationships have been resolved. This is the style used by smgl::WriteDotFile. | |
| auto | nodeStyle (const Node::Pointer &node) const -> NodeStyle |
| Get the evaluated node style for a specific node. | |
| auto | nodeStyle (const Node *node) const -> NodeStyle |
| Get the evaluated node style for a specific node. | |
Node Placement | |
Allows basic placement of nodes according to manually defined rank rules. See the Graphviz rank documentation for more information. | |
| template<typename... Args> | |
| void | setRankMin (const Args &... args) |
| Assign node(s) to the minimum rank. | |
| template<typename... Args> | |
| void | setRankSource (const Args &... args) |
| Assign node(s) to the minimum rank and limits the minimum rank to nodes with rank=min or rank=source. | |
| template<typename... Args> | |
| void | setRankMax (const Args &... args) |
| Assigns node(s) to the maximum rank. | |
| template<typename... Args> | |
| void | setRankSink (const Args &... args) |
| Assign node(s) to the maximum rank and limits the maximum rank to nodes with rank=max or rank=sink. | |
| template<typename... Args> | |
| auto | setRankSame (const Args &... args) -> std::size_t |
| Assign node(s) to a new group ranking. | |
| template<typename T , typename... Args> | |
| void | appendRankSame (T idx, const Args &... args) |
| Assign node(s) to an existing group ranking. | |
| auto | rankMin () -> std::unordered_set< Uuid > & |
| Get the set of nodes assigned to the minimum rank. | |
| auto | rankMin () const -> const std::unordered_set< Uuid > & |
| Get the set of nodes assigned to the minimum rank. | |
| auto | rankSource () -> std::unordered_set< Uuid > & |
| Get the set of nodes assigned to the source rank. | |
| auto | rankSource () const -> const std::unordered_set< Uuid > & |
| Get the set of nodes assigned to the source rank. | |
| auto | rankMax () -> std::unordered_set< Uuid > & |
| Get the set of nodes assigned to the maximum rank. | |
| auto | rankMax () const -> const std::unordered_set< Uuid > & |
| Get the set of nodes assigned to the maximum rank. | |
| auto | rankSink () -> std::unordered_set< Uuid > & |
| Get the set of nodes assigned to the sink rank. | |
| auto | rankSink () const -> const std::unordered_set< Uuid > & |
| Get the set of nodes assigned to the sink rank. | |
| auto | rankSame () -> std::vector< std::vector< Uuid > > & |
| Get the set of rank groups. | |
| auto | rankSame () const -> const std::vector< std::vector< Uuid > > & |
| Get the set of rank groups. | |
Private Attributes | |
| NodeStyle | defaultStyle_ |
| std::unordered_map< std::string, NodeStyle > | classStyles_ |
| std::unordered_map< Uuid, NodeStyle > | instanceStyles_ |
| std::unordered_set< Uuid > | rankMin_ |
| std::unordered_set< Uuid > | rankSrc_ |
| std::unordered_set< Uuid > | rankMax_ |
| std::unordered_set< Uuid > | rankSink_ |
| std::vector< std::vector< Uuid > > | rankSame_ |
Class defining a Graph's style when writing to a Dot file.
This class enables global, class, and instance level styling of Nodes in a Dot file by setting a default style and, optionally, a class-specific or instance-specific style. When determining the final style, class-specific properties take precedence over default properties, and instance-specific properties take precedence over class-specific properties.
Definition at line 100 of file Graphviz.hpp.
| void smgl::GraphStyle::appendRankSame | ( | T | idx, |
| const Args &... | args | ||
| ) |
Assign node(s) to an existing group ranking.
Assign the node(s) to an existing group ranking created with setRankSame().
Definition at line 131 of file GraphvizImpl.hpp.
| auto smgl::GraphStyle::classStyle | ( | ) | -> NodeStyle& |
Access the style for a class of nodes.
If a style has not been set, one is created and returned.
Definition at line 25 of file GraphvizImpl.hpp.
| auto smgl::GraphStyle::classStyle | ( | ) | const -> const NodeStyle& |
Access the style for a class of nodes.
| std::out_of_range | if a style has not been set |
Definition at line 31 of file GraphvizImpl.hpp.
| auto smgl::GraphStyle::classStyle | ( | const std::string & | name | ) | -> NodeStyle & |
Access the style for a class of nodes.
If a style has not been set, one is created and returned.
| auto smgl::GraphStyle::classStyle | ( | const std::string & | name | ) | const -> const NodeStyle & |
Access the style for a class of nodes.
| std::out_of_range | if a style has not been set |
| auto smgl::GraphStyle::defaultStyle | ( | ) | const -> const NodeStyle & |
Access the default node style.
| void smgl::GraphStyle::eraseClassStyle | ( | ) | const |
Erase the style associated with a class of nodes.
Definition at line 19 of file GraphvizImpl.hpp.
| void smgl::GraphStyle::eraseInstanceStyle | ( | const Node * | node | ) |
Erase the style associated with a node instance.
| auto smgl::GraphStyle::hasClassStyle | ( | ) | const -> bool |
Check if a class of nodes has an associated style.
Definition at line 13 of file GraphvizImpl.hpp.
| auto smgl::GraphStyle::hasInstanceStyle | ( | const Node * | node | ) | const -> bool |
Check if a node has an associated instance style.
Access the style for a node instance.
If a style has not been set, one is created and returned.
Access the style for a node instance.
| std::out_of_range | if a style has not been set |
| auto smgl::GraphStyle::instanceStyle | ( | const Node::Pointer & | node | ) | -> NodeStyle & |
Access the style for a node instance.
If a style has not been set, one is created and returned.
| auto smgl::GraphStyle::instanceStyle | ( | const Node::Pointer & | node | ) | const -> const NodeStyle & |
Access the style for a node instance.
| std::out_of_range | if a style has not been set |
| auto smgl::GraphStyle::rankMax | ( | ) | const -> const std::unordered_set< Uuid > & |
Get the set of nodes assigned to the maximum rank.
| auto smgl::GraphStyle::rankMin | ( | ) | const -> const std::unordered_set< Uuid > & |
Get the set of nodes assigned to the minimum rank.
| auto smgl::GraphStyle::rankSame | ( | ) | const -> const std::vector< std::vector< Uuid > > & |
Get the set of rank groups.
| auto smgl::GraphStyle::rankSink | ( | ) | const -> const std::unordered_set< Uuid > & |
Get the set of nodes assigned to the sink rank.
| auto smgl::GraphStyle::rankSource | ( | ) | const -> const std::unordered_set< Uuid > & |
Get the set of nodes assigned to the source rank.
| void smgl::GraphStyle::setClassStyle | ( | const NodeStyle & | style | ) |
Set a class-specific node style.
Sets the style for all nodes of a particular class. Nodes of a particular class are identified using the serialization name register. If unknown, the node's class name in the register can be determined using smgl::NodeName.
Definition at line 7 of file GraphvizImpl.hpp.
| void smgl::GraphStyle::setClassStyle | ( | const std::string & | name, |
| const NodeStyle & | style | ||
| ) |
Set a class-specific node style.
Sets the style for all nodes of a particular class. Nodes of a particular class are identified using the serialization name register. If unknown, the node's class name in the register can be determined using smgl::NodeName.
Set a instance-specific node style.
Sets the style for a single node instance. A node instance is identified using its smgl::Uuid.
| void smgl::GraphStyle::setInstanceStyle | ( | const Node::Pointer & | node, |
| const NodeStyle & | style | ||
| ) |
Set a instance-specific node style.
Sets the style for a single node instance. A node instance is identified using its smgl::Uuid.
| void smgl::GraphStyle::setRankMax | ( | const Args &... | args | ) |
Assigns node(s) to the maximum rank.
Definition at line 73 of file GraphvizImpl.hpp.
| void smgl::GraphStyle::setRankMin | ( | const Args &... | args | ) |
Assign node(s) to the minimum rank.
Definition at line 37 of file GraphvizImpl.hpp.
| auto smgl::GraphStyle::setRankSame | ( | const Args &... | args | ) | -> std::size_t |
Assign node(s) to a new group ranking.
Creates a new rank group and assigns the node(s) to that group. Returns the index of the group ranking so that nodes can be appended to the group with appendRankSame().
Definition at line 109 of file GraphvizImpl.hpp.
| void smgl::GraphStyle::setRankSink | ( | const Args &... | args | ) |
Assign node(s) to the maximum rank and limits the maximum rank to nodes with rank=max or rank=sink.
Definition at line 91 of file GraphvizImpl.hpp.
| void smgl::GraphStyle::setRankSource | ( | const Args &... | args | ) |
Assign node(s) to the minimum rank and limits the minimum rank to nodes with rank=min or rank=source.
Definition at line 55 of file GraphvizImpl.hpp.
|
private |
Class-specific node styles
Definition at line 304 of file Graphviz.hpp.
|
private |
Default node style
Definition at line 302 of file Graphviz.hpp.
|
private |
Instance-specific node styles
Definition at line 306 of file Graphviz.hpp.
|
private |
rank=max nodes
Definition at line 312 of file Graphviz.hpp.
|
private |
rank=min nodes
Definition at line 308 of file Graphviz.hpp.
|
private |
rank=same node groups
Definition at line 316 of file Graphviz.hpp.
|
private |
rank=sink nodes
Definition at line 314 of file Graphviz.hpp.
|
private |
rank=source nodes
Definition at line 310 of file Graphviz.hpp.